Read concern is a MongoDB setting that controls the consistency and isolation of data returned by read operations. It balances consistency, performance, and availability across replica sets and sharded clusters. section 9.5 section 9.5.2
Choose a level according to the application’s tolerance for stale, unavailable, or slower reads:
- local (default) reads from the current instance without waiting for replication; fast results may later be rolled back. section 9.5.2
- available minimizes latency and consistency guarantees, making it useful when availability matters more than accuracy, especially in sharded clusters. section 9.5.2
- majority returns data acknowledged by most replica set members, supporting durable reads that withstand node failures. section 9.5.2
- linearizable provides the strictest consistency by confirming that previous majority-acknowledged writes have been applied, with possible performance overhead. section 9.5.2
- snapshot reads a point-in-time view of majority-committed data across the cluster, which is useful in multidocument transactions. section 9.5.2
Read majority-confirmed data
Apply a read concern to a cursor when a query should return data confirmed by a majority of replica set members: db.routes.find({ src_airport: 'MUC' }).readConcern('majority').
For applications that read their own writes on the primary, pair majority read concern with { w: 'majority' } write concern. Read preference separately determines whether reads target primary or secondary members. section 9.5 section 9.6
