Navigation

Specify Read Preference for a MongoDB Cluster

On this page

You can configure the read preference for a linked MongoDB Atlas cluster to control the type of replica set member that MongoDB Realm routes database read requests to. You can also specify a tag set to target specific members of the replica set.

You cannot set the read preference on a linked Data Lake.

By default, Realm uses a read preference of primary, which routes all read requests through the primary node of a replica set.

The default read preference (primary) should be sufficient for most use cases. Consider specifying a cluster read preference when you need to do the following:

  • Read from a specific secondary that has a custom configuration, such as an analytics node with special indexes optimized for reporting workloads.
  • Read from a node in a specific region of a globally distributed replica set.
  • Maintain read availability during a replica set failover, i.e., continue to read potentially stale data when there is no primary node.
Give Feedback

On this page