Write Concern clarification

Hello,

I am not sure I understand what is a write concern. When setting a write concern, does the application writing data to mongo actually stop and waits till it receives an acknowledgement before continuing to write data? Or is a write concern some sort of “sensor” that tracks down whether all nodes have acknowledged a write operation, and doesn’t affect writing data to the database? Thank you.

@samym0

From my understanding, your first assumption is right. If the application cannot receive acknowledgement requested from the required number of voting nodes, the write operation will block indefinitely. That is why, in best practice, we should specify wtimeout. As such, application will throw an exception after the timeout for acknowledgement.

2 Likes