> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# Read Concern

Use the `readConcern` option to control the consistency and isolation of data read from [replica sets](https://www.mongodb.com/docs/manual/replication.md#std-label-replication) and [sharded clusters.](https://www.mongodb.com/docs/manual/sharding.md#std-label-sharding-background)

Through effective use of [write concerns](https://www.mongodb.com/docs/manual/reference/write-concern.md#std-label-write-concern) and read concerns, you can adjust the level of consistency and availability guarantees. For example, you can wait for stronger consistency guarantees or loosen consistency requirements for higher availability.

Replica sets and sharded clusters support a global default read concern. Operations without an explicit read concern inherit the global default. See [`setDefaultRWConcern`](https://www.mongodb.com/docs/manual/reference/command/setDefaultRWConcern.md#mongodb-dbcommand-dbcmd.setDefaultRWConcern) for more information.

## Read Concern Levels

The following read concern levels are available:

| `level` | Description |
| --- | --- |
| [`"local"`](https://www.mongodb.com/docs/manual/reference/read-concern-local.md#mongodb-readconcern-readconcern.-local-) | The query returns data from the instance with no guarantee that the data has been written to a majority of the replica set members. Data may be rolled back. Default for reads against the primary and secondaries. **Availability:** Read concern [`"local"`](https://www.mongodb.com/docs/manual/reference/read-concern-local.md#mongodb-readconcern-readconcern.-local-) is available with or without causally consistent sessions and transactions. For more information, see the [`"local"`](https://www.mongodb.com/docs/manual/reference/read-concern-local.md#mongodb-readconcern-readconcern.-local-) reference page. |
| [`"available"`](https://www.mongodb.com/docs/manual/reference/read-concern-available.md#mongodb-readconcern-readconcern.-available-) | The query returns data from the instance with no guarantee that the data has been written to a majority of the replica set members. Data may be rolled back. **Availability:** Read concern [`"available"`](https://www.mongodb.com/docs/manual/reference/read-concern-available.md#mongodb-readconcern-readconcern.-available-) is unavailable for use with causally consistent sessions and transactions. For sharded clusters, [`"available"`](https://www.mongodb.com/docs/manual/reference/read-concern-available.md#mongodb-readconcern-readconcern.-available-) read concern provides the lowest latency reads possible among the various read concerns. However, this comes at the expense of consistency as [`"available"`](https://www.mongodb.com/docs/manual/reference/read-concern-available.md#mongodb-readconcern-readconcern.-available-) read concern can return [orphaned documents](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-orphaned-document) when reading from a sharded collection. To avoid the risk of returning orphaned documents when reading from sharded collections, use a different read concern such as read concern [`"local"`.](https://www.mongodb.com/docs/manual/reference/read-concern-local.md#mongodb-readconcern-readconcern.-local-) For more information, see the [`"available"`](https://www.mongodb.com/docs/manual/reference/read-concern-available.md#mongodb-readconcern-readconcern.-available-) reference page. |
| [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-) | The query returns the data acknowledged by a majority of the replica set members. Returned documents are durable, even if a failure occurs. To fulfill read concern `"majority"`, the replica set member returns data from its in-memory view at the majority-commit point. Read concern [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-) has comparable performance to other read concerns. **Availability:** Read concern [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-) is available with or without causally consistent sessions and transactions. **Requirements:** Replica sets must use the [WiredTiger storage engine.](https://www.mongodb.com/docs/manual/core/wiredtiger.md#std-label-storage-wiredtiger) For [multi-document transactions](https://www.mongodb.com/docs/manual/core/transactions.md), read concern `"majority"` provides its guarantees only if the transaction commits with [write concern "majority"](https://www.mongodb.com/docs/manual/core/transactions.md#std-label-transactions-write-concern). Otherwise, [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-) provides no guarantees about data read in transactions. For more information, see the [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-) reference page. |
| [`"linearizable"`](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md#mongodb-readconcern-readconcern.-linearizable-) | The query returns data that reflects all successful majority-acknowledged writes that completed before the start of the read operation. The query may wait for concurrent 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, returned documents are durable if [`writeConcernMajorityJournalDefault`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.writeConcernMajorityJournalDefault) is set to the default value of `true`. With [`writeConcernMajorityJournalDefault`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.writeConcernMajorityJournalDefault) set to `false`, MongoDB does not wait for [`w: "majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) writes to be written to the on-disk journal before acknowledging the writes. As such, [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-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. **Availability:** Read concern [`"linearizable"`](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md#mongodb-readconcern-readconcern.-linearizable-) is unavailable for use with causally consistent sessions and transactions.; You can only specify linearizable read concern for read operations on the [`primary`.](https://www.mongodb.com/docs/manual/reference/replica-states.md#mongodb-replstate-replstate.PRIMARY) You cannot use the [`$out`](https://www.mongodb.com/docs/manual/reference/operator/aggregation/out.md#mongodb-pipeline-pipe.-out) or the [`$merge`](https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge.md#mongodb-pipeline-pipe.-merge) stage in conjunction with read concern [`"linearizable"`](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md#mongodb-readconcern-readconcern.-linearizable-). That is, if you specify [`"linearizable"`](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md#mongodb-readconcern-readconcern.-linearizable-) read concern for [`db.collection.aggregate()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.aggregate.md#mongodb-method-db.collection.aggregate), you cannot include either stages in the pipeline. **Requirements:** Linearizable read concern guarantees only apply if read operations specify a query filter that uniquely identifies a single document. Additionally if none of the following criteria are met, linearizable read concern might not read from a consistent snapshot, resulting in a document matching the filter not being returned: The query uses an immutable field as the search key of the query. For example, searching on the `_id` field or using [`$natural`.](https://www.mongodb.com/docs/manual/reference/method/cursor.hint.md#mongodb-operator-metaOp.-natural); No concurrent updates mutate the search key of the query.; The search key has a [unique index](https://www.mongodb.com/docs/manual/core/index-unique.md#std-label-index-type-unique) and the query uses that index. If any of the preceding criteria are met, the query reads from a consistent snapshot to return the single matching document. Always use `maxTimeMS` with linearizable read concern if a majority of data-bearing members are unavailable. `maxTimeMS` ensures that the operation returns an error if the read concern cannot be fulfilled, rather than blocking indefinitely. For more information, see the [`"linearizable"`](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md#mongodb-readconcern-readconcern.-linearizable-) reference page. |
| [`"snapshot"`](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#mongodb-readconcern-readconcern.-snapshot-) | A query with read concern `"snapshot"` returns majority-committed data as it appears across shards from a specific single point in time in the recent past. Read concern `"snapshot"` provides its guarantees only if the transaction commits with write concern [`"majority"`.](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) If a transaction is not part of a [causally consistent session](https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency.md#std-label-sessions), upon transaction commit with write concern [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-), the transaction operations are guaranteed to have read from a snapshot of majority-committed data. If a transaction is part of a [causally consistent session](https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency.md#std-label-sessions), upon transaction commit with write concern [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-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. **Availability:** Read concern [`"snapshot"`](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#mongodb-readconcern-readconcern.-snapshot-) is available for All read operations inside multi-document transactions, with the read concern set at the transaction level.; The following methods outside of multi-document transactions:[`find`](https://www.mongodb.com/docs/manual/reference/command/find.md#mongodb-dbcommand-dbcmd.find); [`aggregate`](https://www.mongodb.com/docs/manual/reference/command/aggregate.md#mongodb-dbcommand-dbcmd.aggregate); [`distinct`](https://www.mongodb.com/docs/manual/reference/command/distinct.md#mongodb-dbcommand-dbcmd.distinct) on unsharded collections onlyAll other read operations prohibit [`"snapshot"`.](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#mongodb-readconcern-readconcern.-snapshot-) |

Regardless of the [read concern](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-read-concern) level, the most recent data on a node may not reflect the most recent version of the data in the system.

For more information on each read concern level, see:

- [Read Concern "local"](https://www.mongodb.com/docs/manual/reference/read-concern-local.md)

- [Read Concern "available"](https://www.mongodb.com/docs/manual/reference/read-concern-available.md)

- [Read Concern "majority"](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md)

- [Read Concern "linearizable"](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md)

- [Read Concern "snapshot"](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md)

- [Default MongoDB Read Concerns/Write Concerns](https://www.mongodb.com/docs/manual/reference/mongodb-defaults.md)

## `readConcern` Support

### Read Concern Option

For operations not in [multi-document transactions](https://www.mongodb.com/docs/manual/core/transactions.md), you can specify a `readConcern` level as an option to commands and methods that support read concern:

```javascript
readConcern: { level: <level> }
```

To specify the read concern level for [`mongosh`](https://www.mongodb.com/docs/mongodb-shell.md#mongodb-binary-bin.mongosh) method [`db.collection.find()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.find.md#mongodb-method-db.collection.find), use the [`cursor.readConcern()`](https://www.mongodb.com/docs/manual/reference/method/cursor.readConcern.md#mongodb-method-cursor.readConcern) method:

```javascript
db.collection.find().readConcern(<level>)
```

### Transactions and Available Read Concerns

For [multi-document transactions](https://www.mongodb.com/docs/manual/core/transactions.md#std-label-transactions), set the read concern at the transaction level, not at the individual operation level. Transaction operations use the transaction-level read concern. Read concerns set at the collection and database level are ignored inside the transaction. If you explicitly set the transaction-level read concern, the client-level read concern is also ignored.

**Important:**

Do not explicitly set the read concern for individual operations. To set the read concern for transactions, see [Read Concern, Write Concern, and Read Preference.](https://www.mongodb.com/docs/manual/core/transactions.md#std-label-transaction-options)

You can set the read concern at the transaction start:

- Multi-document transactions support the following read concern levels:

  - [`"local"`](https://www.mongodb.com/docs/manual/reference/read-concern-local.md#mongodb-readconcern-readconcern.-local-)

  - [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-)

  - [`"snapshot"`](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#mongodb-readconcern-readconcern.-snapshot-)

- Write commands that are part of a [multi-document transactions](https://www.mongodb.com/docs/manual/core/transactions.md) can support the transaction-level read concern.

- You can [create collections and indexes](https://www.mongodb.com/docs/manual/core/transactions.md#std-label-transactions-create-collections-indexes) inside a transaction. If [explicitly](https://www.mongodb.com/docs/manual/core/transactions-operations.md#std-label-transactions-operations-ddl-explicit) creating a collection or an index, the transaction must use read concern [`"local"`](https://www.mongodb.com/docs/manual/reference/read-concern-local.md#mongodb-readconcern-readconcern.-local-). If you [implicitly](https://www.mongodb.com/docs/manual/core/transactions-operations.md#std-label-transactions-operations-ddl-implicit) create a collection, you can use any of the read concerns available for transactions.

If unspecified at the transaction start, transactions use the session-level read concern or, if that is unset, the client-level read concern.

For more information, see [Transaction Read Concern.](https://www.mongodb.com/docs/manual/core/transactions.md#std-label-transactions-read-concern)

### Causally Consistent Sessions and Available Read Concerns

For operations in a [causally consistent session](https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency.md#std-label-causal-consistency), the [`"local"`](https://www.mongodb.com/docs/manual/reference/read-concern-local.md#mongodb-readconcern-readconcern.-local-), [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-), and [`"snapshot"`](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#mongodb-readconcern-readconcern.-snapshot-) levels are available. To guarantee causal consistency, use [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-). For details, see [Causal Consistency.](https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency.md#std-label-causal-consistency)

### Operations That Support Read Concern

The following operations support read concern:

**Important:**

To set read concern for operations in a transaction, you set the read concern at the transaction level, not at the individual operation level. Do not explicitly set the read concern for the individual operations in a transaction. For more information, see [Transactions and Read Concern.](https://www.mongodb.com/docs/manual/core/transactions.md#std-label-transactions-read-concern)

| Command/Method | [`"local"`](https://www.mongodb.com/docs/manual/reference/read-concern-local.md#mongodb-readconcern-readconcern.-local-) | [`"available"`](https://www.mongodb.com/docs/manual/reference/read-concern-available.md#mongodb-readconcern-readconcern.-available-) | [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-) | [`"snapshot"`](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#mongodb-readconcern-readconcern.-snapshot-) | [`"linearizable"`](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md#mongodb-readconcern-readconcern.-linearizable-) |
| --- | --- | --- | --- | --- | --- |
| [`count`](https://www.mongodb.com/docs/manual/reference/command/count.md#mongodb-dbcommand-dbcmd.count) | ✓ | ✓ | ✓ |  | ✓ |
| [`distinct`](https://www.mongodb.com/docs/manual/reference/command/distinct.md#mongodb-dbcommand-dbcmd.distinct) | ✓ | ✓ | ✓ | ✓ | ✓ |
| [`find`](https://www.mongodb.com/docs/manual/reference/command/find.md#mongodb-dbcommand-dbcmd.find) | ✓ | ✓ | ✓ | ✓ | ✓ |
| [`db.collection.find()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.find.md#mongodb-method-db.collection.find) via [`cursor.readConcern()`](https://www.mongodb.com/docs/manual/reference/method/cursor.readConcern.md#mongodb-method-cursor.readConcern) | ✓ | ✓ | ✓ | ✓ | ✓ |
| [`getMore`](https://www.mongodb.com/docs/manual/reference/command/getMore.md#mongodb-dbcommand-dbcmd.getMore) | ✓ |  |  |  | ✓ |
| [`aggregate`](https://www.mongodb.com/docs/manual/reference/command/aggregate.md#mongodb-dbcommand-dbcmd.aggregate) [`db.collection.aggregate()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.aggregate.md#mongodb-method-db.collection.aggregate) | ✓ | ✓ | ✓ | ✓ | ✓ |
| [`Session.startTransaction()`](https://www.mongodb.com/docs/manual/reference/method/Session.startTransaction.md#mongodb-method-Session.startTransaction) | ✓ |  | ✓ | ✓ | |

You cannot use the [`$out`](https://www.mongodb.com/docs/manual/reference/operator/aggregation/out.md#mongodb-pipeline-pipe.-out) or the [`$merge`](https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge.md#mongodb-pipeline-pipe.-merge) stage in conjunction with read concern [`"linearizable"`](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md#mongodb-readconcern-readconcern.-linearizable-). That is, if you specify [`"linearizable"`](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md#mongodb-readconcern-readconcern.-linearizable-) read concern for [`db.collection.aggregate()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.aggregate.md#mongodb-method-db.collection.aggregate), you cannot include either stages in the pipeline.

Read concern [`"snapshot"`](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#mongodb-readconcern-readconcern.-snapshot-) is available only for certain read operations and for multi-document transactions. In a transaction, you cannot use the `distinct` command or its helpers on a sharded collection.

The following write operations can also accept a read concern if part of a multi-document transaction:

**Important:**

To set read concern for operations in a transaction, you set the read concern at the transaction level, not at the individual operation level.

| Command | [`"local"`](https://www.mongodb.com/docs/manual/reference/read-concern-local.md#mongodb-readconcern-readconcern.-local-) | [`"available"`](https://www.mongodb.com/docs/manual/reference/read-concern-available.md#mongodb-readconcern-readconcern.-available-) | [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-) | [`"snapshot"`](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#mongodb-readconcern-readconcern.-snapshot-) | [`"linearizable"`](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md#mongodb-readconcern-readconcern.-linearizable-) |
| --- | --- | --- | --- | --- | --- |
| [`delete`](https://www.mongodb.com/docs/manual/reference/command/delete.md#mongodb-dbcommand-dbcmd.delete)[`db.collection.deleteOne()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.deleteOne.md#mongodb-method-db.collection.deleteOne)[`db.collection.deleteMany()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.deleteMany.md#mongodb-method-db.collection.deleteMany)[`db.collection.remove()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.remove.md#mongodb-method-db.collection.remove) | ✓ |  |  | ✓ | |
| [`findAndModify`](https://www.mongodb.com/docs/manual/reference/command/findAndModify.md#mongodb-dbcommand-dbcmd.findAndModify)[`db.collection.findAndModify()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.findAndModify.md#mongodb-method-db.collection.findAndModify)[`db.collection.findOneAndDelete()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.findOneAndDelete.md#mongodb-method-db.collection.findOneAndDelete)[`db.collection.findOneAndReplace()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.findOneAndReplace.md#mongodb-method-db.collection.findOneAndReplace)[`db.collection.findOneAndUpdate()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.findOneAndUpdate.md#mongodb-method-db.collection.findOneAndUpdate) | ✓ |  |  | ✓ | |
| [`insert`](https://www.mongodb.com/docs/manual/reference/command/insert.md#mongodb-dbcommand-dbcmd.insert)[`db.collection.insertOne()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.insertOne.md#mongodb-method-db.collection.insertOne)[`db.collection.insertMany()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.insertMany.md#mongodb-method-db.collection.insertMany) | ✓ |  |  | ✓ | |
| [`update`](https://www.mongodb.com/docs/manual/reference/command/update.md#mongodb-dbcommand-dbcmd.update)[`db.collection.updateOne()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.updateOne.md#mongodb-method-db.collection.updateOne)[`db.collection.updateMany()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.updateMany.md#mongodb-method-db.collection.updateMany)[`db.collection.replaceOne()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.replaceOne.md#mongodb-method-db.collection.replaceOne) | ✓ |  |  | ✓ | |
| [`create`](https://www.mongodb.com/docs/manual/reference/command/create.md#mongodb-dbcommand-dbcmd.create)[`db.createCollection()`](https://www.mongodb.com/docs/manual/reference/method/db.createCollection.md#mongodb-method-db.createCollection)(Requires [FCV](https://www.mongodb.com/docs/manual/reference/command/setFeatureCompatibilityVersion.md#std-label-view-fcv) 6.0 or greater) | ✓ |  |  |  | |
| [`createIndexes`](https://www.mongodb.com/docs/manual/reference/command/createIndexes.md#mongodb-dbcommand-dbcmd.createIndexes)[`db.collection.createIndex()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.createIndex.md#mongodb-method-db.collection.createIndex)[`db.collection.createIndexes()`](https://www.mongodb.com/docs/manual/reference/method/db.collection.createIndexes.md#mongodb-method-db.collection.createIndexes)(Requires [FCV](https://www.mongodb.com/docs/manual/reference/command/setFeatureCompatibilityVersion.md#std-label-view-fcv) 6.0 or greater) | ✓ |  |  |  | |

Read concern [`"snapshot"`](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#mongodb-readconcern-readconcern.-snapshot-) is available only for certain read operations and multi-document transactions. For transactions, set the read concern at the transaction level. Transaction operations that support [`"snapshot"`](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#mongodb-readconcern-readconcern.-snapshot-) correspond to the CRUD operations available in transactions. For more information, see [Transactions and Read Concern.](https://www.mongodb.com/docs/manual/core/transactions.md#std-label-transactions-read-concern)

### Read Concern not Supported on `local` Database

The [local database](https://www.mongodb.com/docs/manual/reference/local-database.md#std-label-replica-set-local-database) does not support read concerns. MongoDB silently ignores any configured read concern for operations on collections in the local database.

## Considerations

### Read Your Own Writes

You can use [causally consistent sessions](https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency.md#std-label-sessions) to read your own writes, if the writes request acknowledgment.

### Real Time Order

Combined with [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) write concern, [`"linearizable"`](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md#mongodb-readconcern-readconcern.-linearizable-) read concern enables multiple threads to perform reads and writes on a single document as if a single thread performed these operations in real time. The corresponding schedule for these reads and writes is considered linearizable.

### Performance Comparisons

Unlike [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-), [`"linearizable"`](https://www.mongodb.com/docs/manual/reference/read-concern-linearizable.md#mongodb-readconcern-readconcern.-linearizable-) read concern confirms with secondary members that the read operation reads from a primary capable of confirming writes with [`{ w: "majority" }`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) write concern.  Reads with linearizable read concern may be significantly slower than reads with [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-) or [`"local"`](https://www.mongodb.com/docs/manual/reference/read-concern-local.md#mongodb-readconcern-readconcern.-local-) read concerns.

Always use `maxTimeMS` with linearizable read concern if a majority of data-bearing members are unavailable. `maxTimeMS` ensures that the operation returns an error if the read concern cannot be fulfilled, rather than blocking indefinitely.

For example:

```javascript
db.restaurants.find( { _id: 5 } ).readConcern("linearizable").maxTimeMS(10000)

db.runCommand( {
     find: "restaurants",
     filter: { _id: 5 },
     readConcern: { level: "linearizable" },
     maxTimeMS: 10000
} )
```

In [some circumstances](https://www.mongodb.com/docs/manual/core/read-preference-use-cases.md#std-label-edge-cases), two nodes in a replica set may *transiently* believe that they are the primary, but at most, one of them will be able to complete writes with [`{ w: "majority" }`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) write concern. The node that can complete [`{ w: "majority" }`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) writes is the current primary, and the other node is a former primary that has not yet recognized its demotion, typically due to a [network partition](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-network-partition). When this occurs, clients that connect to the former primary may observe stale data despite having requested read preference [`primary`](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-primary), and new writes to the former primary will eventually roll back.

### Read Operations and `afterClusterTime`

MongoDB supports [causally consistent sessions](https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency.md#std-label-sessions). For read operations in causally consistent sessions, drivers automatically set the `afterClusterTime` read concern option.

**Important:**

Do not manually set `afterClusterTime` for a read operation. MongoDB drivers set this value automatically for operations in causally consistent sessions. However, you can advance the operation time and the cluster time for the session, such as to be consistent with the operations of another client session. For an example, see [Examples.](https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency.md#std-label-causal-consistency-examples)

**Note:**

You cannot specify [atClusterTime](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#std-label-atClusterTime) together with `afterClusterTime`. To use [atClusterTime](https://www.mongodb.com/docs/manual/reference/read-concern-snapshot.md#std-label-atClusterTime) with read concern `"snapshot"`, disable [causally consistent sessions.](https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency.md#std-label-sessions)

To satisfy a read request with an `afterClusterTime` value of `T`, a [`mongod`](https://www.mongodb.com/docs/manual/reference/program/mongod.md#mongodb-binary-bin.mongod) must perform the request after its oplog reaches time `T`. If its oplog has not reached time `T`, the [`mongod`](https://www.mongodb.com/docs/manual/reference/program/mongod.md#mongodb-binary-bin.mongod) waits to service the request.

Read operations with a specified `afterClusterTime` return data that meets both the [read concern level](https://www.mongodb.com/docs/manual/reference/read-concern.md#std-label-read-concern-levels) requirement and the specified `afterClusterTime` requirement.

For read operations not associated with causally consistent sessions, `afterClusterTime` is unset.

### Read Concern Provenance

MongoDB tracks read concern `provenance`, which indicates the source of a read concern. The `provenance` value appears in the [`getLastError`](https://www.mongodb.com/docs/manual/reference/command/serverStatus.md#mongodb-serverstatus-serverstatus.metrics.getLastError) metrics, read concern error objects, and MongoDB logs.

The following table shows the possible read concern `provenance` values and their significance:

| Provenance | Description |
| --- | --- |
| `clientSupplied` | The read concern was specified in the application. |
| `customDefault` | The read concern originated from a custom defined default value. See [`setDefaultRWConcern`.](https://www.mongodb.com/docs/manual/reference/command/setDefaultRWConcern.md#mongodb-dbcommand-dbcmd.setDefaultRWConcern) |
| `implicitDefault` | The read concern originated from the server in absence of all other read concern specifications. |
