settings.getLastErrorDefaults
A document that specifies the write concern for the replica set.
The replica set will use this write concern only when write operations or getLastError specify no other write concern.
Does the “settings.getLastErrorDefaults” setting change the Write Conern option by default for all write queries for mongodb server?
And what is the value that has changed like this, and if the Write Conern applied to the query comes in? Are you saying that if the w option exists in operation, you ignore the setting value of settings.getLastErrorDefaults?
Does the “settings.getLastErrorDefaults” setting change the Write Concern option by default for all write queries for mongodb server?
“settings.getLastErrorDefaults” is an optional document specified in the replica set configuration - rsconf. It specifies the default write concern for the replica set.
But, you can override this default setting for example, for a specific write operation:
And what is the value that has changed like this, and if the Write Concern applied to the query comes in? Are you saying that if the w option exists in operation, you ignore the setting value of settings.getLastErrorDefaults?
The write concern for a replica set describes the number of data-bearing members (i.e. the primary and secondaries, but not arbiters) that must acknowledge a write operation before the operation returns as successful.
In a replica set, data gets in sync on all nodes. The write concern specifies that an acknowledgement is received after the data is written to 1, n (2 or 3 in your case) or 'majority' of the nodes. So, whatever the value you specify, the data is always syncd on all data bearing nodes. The write concern determines the acknowledgement level only.