Navigation

Default MongoDB Read Concerns/Write Concerns

On this page

  • Read Concern
  • Write Concern
  • Causally Consistency Guarantees
Read/Write Concern Inheritance

The default read concern is as follows:

Operations
Default Read Concern
Reads against primary

"local"

Note
  • This read concern can return data that may be rolled back.
  • This read concern does not guarantee causal consistency.
Reads against secondaries.

"local"

Note
  • This read concern can return data that may be rolled back.
  • This read concern does not guarantee causal consistency.

For more information on the available read concerns, see Read Concern.

Read/Write Concern Inheritance

Starting in MongoDB 5.0, the implicit default write concern is w: majority. However, special considerations are made for deployments containing arbiters:

  • If the number of data-bearing voting members is not strictly more than the voting majority, the default write concern is w: 1.
  • In all other scenarios, the default write concern is w: "majority".

Specifically, MongoDB uses the following formula to determine the default write concern:

if [(#arbiters > 0) AND (#arbiters >= ½(#voting nodes) - 1)]
defaultWriteConcern = { w: 1 }
else
defaultWriteConcern = { w: majority }
Note
  • With the default write concern, data can be rolled back.
  • This write concern does not guarantee causal consistency.

For more information on the available write concerns, see Write Concern.

With causally consistent client sessions, the client sessions only guarantee causal consistency if:

Give Feedback

On this page

  • Read Concern
  • Write Concern
  • Causally Consistency Guarantees