Docs Menu

Docs HomeDevelop ApplicationsMongoDB Manual

Read Concern "snapshot"

New in version 4.0.

Read concern "snapshot" is only available for multi-document transactions.

A snapshot is a complete copy of the data in a mongod instance at a specific point in time. You can retrieve snapshot metadata for the whole cluster or replica set, or for a single config server in a cluster. For more details, see snapshots.

  • If the transaction is not part of a causally consistent session, upon transaction commit with write concern "majority", the transaction operations are guaranteed to have read from a snapshot of majority-committed data.

  • If the transaction is part of a causally consistent session, upon transaction commit with write concern "majority", the transaction operations are guaranteed to have read from a snapshot of majority-committed data that provides causal consistency with the operation immediately preceding the transaction start.

For a list of all operations that accept read concerns, see Operations That Support Read Concern.

Multi-document transactions support read concern "snapshot" as well as "local", and "majority".

Note

You set the read concern at the transaction level, not at the individual operation level. To set the read concern for transactions, see Transactions and Read Concern.

For transactions on a sharded cluster, if any operation in the transaction involves a shard that has disabled read concern "majority", you cannot use read concern "snapshot" for the transaction. You can only use read concern "local" or "majority" for the transaction. If you use read concern "snapshot", the transaction errors and aborts. For more information, see Disabled Read Concern Majority.

←  Read Concern "linearizable"Write Concern →