How update works internally

Hi Everyone,
I am new here,
I have a scenarion, say I am using updateAndModify method and marking the status as “processing” for that document and at the same time if a get request comes for the same document will the old data will be returned for the get request or it will wait for the update operation to complete and then pass new data back,
Also wanted to understand, if we are writing in master server, at the same time will the slave get updated or not.

Yes, but not at the same time. Replication takes time, even in light speed.

Can be either. The read either happens before the update or happens after the update.
That being said, you will never see a “tearing” value. (meaning, only half write goes through).

2 Likes

Thanks Kobe for clarifying my doubts. Much Appreciated.