• "snapshot"

Read Concern "snapshot"

New in version 4.0.

Read concern "snapshot" is only available for multi-documenttransactions.

  • If the transaction is not part of a causally consistent session, upon transaction commit with write concern"majority", the transaction operations are guaranteedto 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 guaranteedto have read from a snapshot of majority-committed data that providescausal consistency with the operation immediately preceding thetransaction start.

Operations

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

Read Concern and Transactions

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 theindividual operation level. To set the read concern fortransactions, see Transactions and Read Concern.

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

Causally Consistent Sessions

snapshot is available for transactions that are part ofa causally consistent session.