Make other transaction wait till the current transaction finishes

How can I make other transactions wait till the current transaction finishes. I do not want a write conflict instead I other transactions to wait till the ongoing transaction finishes. Is it possible or even efficient to do so?
ps- I am updating multiple documents and hence transactions are necessary for me in this case

Hi @Adhiraj_Kinlekar,

A write conflict means that another concurrent update has affected a document used in the current transaction, so it is expected that the transaction should re-read the state of documents before continuing. You would not want a transaction to continue with an update based on stale data.

What problem are you trying to solve by ignoring write conflicts? You could implement some sort of semaphore logic to prevent multiple transactions from starting until an in-progress transaction has completed, but that seems inefficient and limiting compared to correctly handing write conflicts from concurrent updates.

The Production Considerations sections of the Transactions documentation has some information which may be helpful including In-progress Transactions and Write Conflicts and In-progress Transactions and Stale Reads.

Regards,
Stennie