MongoDB Read Concern

Intermediate
7 min read
Updated: Nov 2026
Getting Started

What Is Read Concern?

Read concern controls how up to date and how durable the data you read must be. In a replica set, a write may be visible on the primary before it has been copied to a majority of members. If the primary fails, such a write can be rolled back. Higher read concern levels only return data that is safe from rollback, at the cost of some latency.

Why It Matters

ReasonBenefit
Avoid rolled-back datamajority prevents your application from acting on writes that later disappear.
Choose your tradeoffFast reads with local, safer reads with majority.
Consistent transactionssnapshot gives all reads in a transaction one consistent view.
Predictable behaviorKnowing the level helps you reason about stale or missing data.

How To Use It

  1. Connect to a replica set and note that the default read concern is local.
  2. Run a query with .readConcern("majority") and compare results in a failover test if possible.
  3. Use majority for data that must not be rolled back, such as financial records.
  4. Use linearizable only for single-document reads that need the strongest guarantee, and add a maxTimeMS.
  5. Use snapshot inside transactions to get a consistent view.
  6. Combine with write concern majority so your writes are visible to majority reads.
  7. Set the default for a connection through the connection string if most reads need it.

mongosh Examples

mongosh
// Default (local)
db.accounts.find({ _id: "A" })

// Only data acknowledged by a majority of members
db.accounts.find({ _id: "A" }).readConcern("majority")

// Strongest guarantee, primary only; set a timeout
db.runCommand({
  find: "accounts",
  filter: { _id: "A" },
  readConcern: { level: "linearizable" },
  maxTimeMS: 10000
})

// Write with majority so a majority read can see it
db.accounts.insertOne({ _id: "C", balance: 10 }, { writeConcern: { w: "majority" } })

// In a transaction
// session.startTransaction({ readConcern: { level: "snapshot" }, writeConcern: { w: "majority" } })

Edge Cases & Pitfalls

local can read rolled-back writes

After a failover, data visible with local might disappear if it was not replicated to a majority.

Higher levels add latency

majority and linearizable may wait for replication, so reads are slower than local.

linearizable limits

It applies to reads of a single document on the primary and can block, so always set maxTimeMS.

available is for sharded clusters

It can return orphaned documents; do not use it where correctness matters.

Standalone servers

Stronger levels require a replica set; a standalone does not support majority in the same way.

Cheat Sheet

TopicDetail
localDefault for reads on the primary; returns the node's most recent data, which could be rolled back
availableFor secondaries in a sharded cluster; lowest latency, may return orphaned documents
majorityReturns data acknowledged by a majority of replica set members
linearizableReflects all majority-acknowledged writes that completed before the read; primary only
snapshotUsed in multi-document transactions for a consistent point-in-time view
Per operationSet it in find options or the session; mongosh uses .readConcern() on cursors
Connection string?readConcernLevel=majority
Paired with write concernWrite w: majority plus read majority gives you read-your-writes guarantees

Key Takeaways

local is fast and may return data that can later be rolled back. majority returns only data acknowledged by a majority. linearizable is the strictest and is for single-document reads on the primary.

Frequently Asked Questions

What is the default read concern?

local for reads on the primary and on secondaries. Inside a transaction, the read concern is set at the transaction level.

What does majority read concern do?

It returns only data that has been acknowledged by a majority of replica set members, so it cannot be rolled back.

When should I use linearizable?

When a read must reflect every majority-acknowledged write that completed before it, for a single document. It is slow and only on the primary.

How does read concern differ from read preference?

Read preference picks which member serves the read. Read concern defines how consistent and durable the data returned must be.

Do I need write concern majority too?

For read-your-own-write behavior with majority reads, yes. Pair w: majority writes with majority reads.

Is snapshot only for transactions?

It is mainly used in multi-document transactions, where it gives all reads one consistent point-in-time view.

Next: MongoDB Write Concern

Continue the MongoDB learning path.

MongoDB Write Concern →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful