What is the correct read preference option to direct all read operations to the secondary?
MongoDB read preference controls which replica-set members are eligible to serve read operations. The mode secondary sends reads only to eligible secondary members. If no suitable secondary is available, the read fails rather than falling back to the primary. That strict behavior is exactly what the question asks for. secondaryPreferred, option A, normally routes reads to secondaries but can use the primary when no suitable secondary is available, so it does not guarantee that every read is served by a secondary. Options B and C are not valid MongoDB read preference mode names. Secondary reads are useful for specific workloads, but DBAs must account for asynchronous replication: a secondary can lag the primary, so data returned from a secondary may be stale relative to the latest acknowledged primary write. MongoDB provides additional controls such as tag sets and maximum staleness settings to restrict which secondary members are considered acceptable. When the explicit requirement is to direct all reads away from the primary and exclusively to secondary members, secondary is the correct read preference. Therefore option D is correct.
Study Guide reference/topic:Cluster Reliability and Data Resilience - replica-set read preferences, secondary reads, and staleness.
===========
Currently there are no comments in this discussion, be the first to comment!