Question 50 / 50
What is a replica set, and what do write concern and read preference control?
Short answer
A replica set is a primary plus secondaries that replicate the oplog — that is high availability and failover. Write concern is how many members must acknowledge a write. Read preference is which members are allowed to serve reads.
Why?
w: 1 acknowledges on the primary and can be rolled back if that primary dies before replicating. w: 'majority' survives failover and is the safe default for important writes. Reading from secondaries adds capacity but can return stale data because replication is asynchronous — fine for analytics, wrong for read-after-write. Sharding is a different axis: it distributes data for horizontal scale, not the same as replication.
Interview tip
Connect majority write concern to failover, not to a vague 'safer'. Mention that sharding is not how you get high availability.
Common mistake
Mixing up replica sets (copies of the same data) with sharding (slices of the data).
How did you do?