MongoDB & NoSQL (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What is Read Preference in MongoDB Replica Sets?
senior LevelSystem DesignDatabases & SQL
In Simple Words: Determines which replica set node receives read queries:
primary(Default): All reads route to the Primary. Guarantees strong consistency.primaryPreferred: Reads from Primary; falls back to Secondary if Primary is down.secondary: Reads strictly from Secondary nodes (offloads analytical reporting from primary; risk of reading stale data).secondaryPreferred: Reads from Secondary; falls back to Primary if no secondaries are reachable.nearest: Reads from the node with the lowest network latency.