C100DBA · Question #129
Which of the following is true of the mechanics of replication in MongoDB? Check all that apply.
The correct answer is C. Operations on the primary are recorded in a capped collection called the oplog. Option C is correct because MongoDB records all write operations on the primary in the oplog (local.oplog.rs), which is a capped collection - meaning it has a fixed size and automatically overwrites its oldest entries. Secondaries tail this oplog to replay operations and stay…
Question
Which of the following is true of the mechanics of replication in MongoDB? Check all that apply.
Options
- AMembers of a replica set may replicate data from any other data-bearing member of the set by
- BClients read from the nearest member of a replica ser by default
- COperations on the primary are recorded in a capped collection called the oplog
How the community answered
(32 responses)- A3% (1)
- B9% (3)
- C88% (28)
Explanation
Option C is correct because MongoDB records all write operations on the primary in the oplog (local.oplog.rs), which is a capped collection - meaning it has a fixed size and automatically overwrites its oldest entries. Secondaries tail this oplog to replay operations and stay in sync with the primary.
Option A is wrong because, by default, secondaries replicate from the primary, not from any arbitrary data-bearing member. While replica set chaining (syncing from another secondary) is possible, it must be explicitly enabled and is not the default mechanic.
Option B is wrong because MongoDB's default read preference is primary, meaning clients read from the primary unless you explicitly configure a different read preference (such as nearest, secondary, or primaryPreferred).
Memory tip: Think of the oplog as the primary's diary - every write gets logged there, and secondaries are just followers reading that diary to stay caught up. "Default reads go to the boss (primary)" helps you remember that clients don't automatically spread reads to nearby members.
Topics
Community Discussion
No community discussion yet for this question.