The query returns data that reflects all successful majority-acknowledged writes that completed prior to the start of the read operation. The query may wait for concurrently executing writes to propagate to a majority of replica set members before returning results.
If a majority of your replica set members crash and restart after
the read operation, documents returned by the read operation are
durable if writeConcernMajorityJournalDefault
is set to
the default state of true
.
With writeConcernMajorityJournalDefault
set to false
,
MongoDB does not wait for w: "majority"
writes to be written to the on-disk journal before acknowledging the
writes. As such, majority
write operations could
possibly roll back in the event of a transient loss (e.g. crash and
restart) of a majority of nodes in a given replica set.
You can specify linearizable read concern for read operations on
the primary
only.
Read concern linearizable
is unavailable for use
with causally consistent sessions.
Linearizable read concern guarantees only apply if read operations specify a query filter that uniquely identifies a single document.
Tip
Always use maxTimeMS
with linearizable read concern in
case a majority of data bearing members are unavailable.
maxTimeMS
ensures that the operation does not block
indefinitely and instead ensures that the operation returns
an error if the read concern cannot be fulfilled.
For more information, see the "linearizable"
reference page.