I could not find in mongodb's documentation what's the default write concern and how an "acknowledged write" is defined. It seems that this have changed throughout the different mongodb versions as shows the v3.2 documentation for example:
In 3.2-versions earlier than 3.2.6, w: "majority" implies j: true if journaling is enabled. With earlier versions of MongoDB, w: majority" does not imply journaling.
Or:
Changed in version 3.0: Prior to MongoDB 3.0, w: "majority" refers to the majority of the replica set’s members.
Or:
Changed in version 2.6: In Master/Slave deployments, MongoDB treats w: "majority" as equivalent to w: 1. In earlier versions of MongoDB, w: "majority" produces an error in master/slave deployments.
Also, I'm wondering that "majority" refers to all voting nodes in v3.2 documentation :
Requests acknowledgment that write operations have propagated to the majority of voting nodes [1], including the primary.
Does this mean that even arbiters count since they are voting nodes? So, for example, if I have a replSet consisting of 2 data bearing nodes plus 1 arbiter, a write operation with write concern "majority" would succeed even if 1 data bearing node went down because the write was acknowledged by the remaining data bearing node and the arbiter, hence the majority?
From mongoDB 5.0, w: majority is the default write concern for most MongoDB configurations. It's mostly because the value of implicit default write concern depends on your configrations.
for example, in a PSA replica sets, it's 1. but in a PSS(which is recommended) replica sets, it's value will be majority.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With