For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
See how MongoDB 9.0 delivers up to 2x higher throughput.
MongoDB Branding Shape
Register now >
Docs Menu

Hedged Read Option

Important

Starting in MongoDB 8.0, hedged reads are deprecated. Queries that specify the read preference nearest no longer use hedged reads by default. If you explicitly specify a hedged read, MongoDB performs a hedged read and logs a warning.

You can specify the use of hedged reads for non-primary read preferences on sharded clusters.

With hedged reads, the mongos instances can route read operations to two replica set members per each queried shard and return results from the first respondent per shard.

Hedged reads are supported for the following operations:

To specify hedged read for a read preference, use the hedged read option for read preferences.

To use hedged reads, enable the hedge read option for non-primary read preferences.

For more information on hedged reads, see Hedged Reads.

For details on member selection for hedged reads, see Read Preference and Shards.

The command serverStatus and its corresponding mongosh method db.serverStatus() return hedgingMetrics.