- Primary — accepts all writes, replicates changes via the oplog
- Secondary — replicates the primary's data, can serve reads
- If the primary fails, the replica set automatically elects a new primary
Replication in MongoDB
A replica set is a group of MongoDB servers holding the same data — one primary handles writes, secondaries replicate it for redundancy and read scaling.