MongoDB Documentation, Release 3.0.4 Read Preference Processes Member Selection Request Association Changed in version 2.2. MongoDB drivers use the following procedures to direct operations to replica sets and sharded clusters. To determine how to route their operations, applications periodically update their view of the replica set’s state, identifying which members are up or down, which member is primary , and verifying the latency to each mongod instance. Clients, by way of their drivers, and mongos instances for sharded clusters, periodically update their view of the replica set’s state. When you select non- primary (page 657) read preference, the driver will determine which member to target using the following process: Applications can configure the threshold used in this stage. The default “acceptable latency” is 15 milliseconds, which you can override in the drivers with their own secondaryAcceptableLatencyMS option. For mongos you can use the --localThreshold or localPingThresholdMs runtime options to set this value. Drivers can then associate the thread or connection with the selected member. This request association (page 591) is configurable by the application. See your driver documentation about request association configuration and default behavior. Important: Request association is configurable by the application. See your driver documentation about request association configuration and default behavior. Because secondary members of a replica set may lag behind the current primary by different amounts, reads for secondary members may reflect data at different points in time. To prevent sequential reads from jumping around in time, the driver can associate application threads to a specific member of the set after the first read, thereby preventing reads from other members. The thread will continue to read from the same member until: When using request association, if the client detects that the set has elected a new primary , the driver will discard all associations between threads and members. 591 9.2. Replication Concepts • The application performs a read with a different read preference, • The thread terminates, or • The client receives a socket exception, as is the case when there’s a network error or when the mongod closes connections during a failover . This triggers a retry (page 592), which may be transparent to the application. 5. Selects a member from these hosts at random. The member receives the read operation. 4. Builds a list of members that are within a defined ping distance (in milliseconds) of the “absolute nearest” member. 3. Determines which suitable member is the closest to the client in absolute terms. 2. Excludes members not matching the tag sets, if specified. 1. Assembles a list of suitable members, taking into account member type (i.e. secondary, primary, or all members).