WriteConcern Query

Replica set consist of 3 nodes and one of the node is out.

Running the below query

use payroll
{ “name”: “Aditya”, “salary_USD”: 50000 },
{ “writeConcern”: { “w”: 3, “wtimeout”: 1000 } }

Is below statement true about this write operation?

  1. w: “majority” would also cause this write operation to return with an error.

Please explain your answer too.


(my prev. answer was not correct)

A write concern with majority is successful if the app receives acknowledgement from a majority of the nodes. ( floor(N/2) + 1 )

For a 3-node replica set, 2 acknowledgements will be enough for successful operation.

This should guide you better.


Please refer our docs for more information on this :

~ Shubham