Read Preference
On this page
- Overview
- When To Specify Read Preference
- Procedure
- Navigate to the Cluster Configuration Screen
- Specify a Cluster Read Preference
- Specify Read Preference Tags
- Save the Cluster Configuration
- Pull the Latest Version of Your App
- Specify a Cluster Read Preference
- Specify Read Preference Tags
- Deploy the Updated Data Source Configuration
Overview
You can configure the read preference for a linked MongoDB Atlas cluster to control the type of replica set member that Atlas App Services 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 Federated data source.
By default, App Services uses a read preference of primary
, which routes
all read requests through the primary node of a replica set.
When To Specify Read Preference
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.