MongoDB drivers support five read preference modes. Tag sets allow you to target read operations to specific members of a replica set. Custom read preferences and write concerns evaluate tag sets in different ways. Read preferences consider the value of a tag when selecting a member to read from. Write concerns ignore the value of a tag to when selecting a member, except to consider whether or not the value is unique. You can specify tag sets with the following read preference modes: Tags are not compatible with mode primary (page 657) and, in general, only apply when selecting (page 591) a secondary member of a set for a read operation. However, the nearest (page 658) read mode, when combined with a tag set, selects the matching member with the lowest network latency. This member may be a primary or secondary. All interfaces use the same member selection logic (page 591) to choose the member to which to direct read operations, basing the choice on read preference mode and tag sets. For information on configuring tag sets, see the Configure Replica Set Tag Sets (page 635) tutorial. For more information on how read preference modes (page 657) interact with tag sets, see the documentation for each read preference mode (page 656). $^{14}$https://api.mongodb.org/ $^{15}$https://api.mongodb.org/ Chapter 9. Replication 590 • primaryPreferred (page 657) • secondary (page 658) • secondaryPreferred (page 658) • nearest (page 658) The syntax for specifying the read preference mode is specific to the driver and to the idioms of the host language$^{14}$. Read preference modes are also available to clients connecting to a sharded cluster through a mongos . The mongos instance obeys specified read preferences when connecting to the replica set that provides each shard in the cluster. In the mongo shell, the readPref() cursor method provides access to read preferences. For more information, see read preference background (page 588) and read preference behavior (page 591). See also the documentation for your driver$^{15}$. Tag Sets MongoDB Documentation, Release 3.0.4 Read Preference Mode Description primary (page 657) Default mode. All operations read from the current replica set primary . primaryPreferred (page 657) In most situations, operations read from the primary but if it is unavailable, operations read from secondary members. secondary (page 658) All operations read from the secondary members of the replica set. secondaryPreferred (page 658) In most situations, operations read from secondary members but if no secondary members are available, operations read from the primary . nearest (page 658) Operations read from member of the replica set with the least network latency, irrespective of the member’s type.