Exam prep replication in MongoDB

In the following question:

Which of the following is true of the mechanics of replication in MongoDB? Check all that apply.

a. Operations on the primary are recorded in a capped collection called the oplog.
b. Members of a replica set may replicate data from any other data-bearing member of the set by default.
c. Clients read from the nearest member of a replica set by default.

It says a and b are correct. But my understanding from the docs is that the Primary receives updates and stores in it’s oplog and that oplog is copied to the secondaries?

Please read https://docs.mongodb.com/manual/core/replica-set-sync/#replication.

Just to add…

It’s possible that at the time of recording, much older versions of MongoDB (<= 3.6) were syncing from the Primary by default. @Shubham_Ranjan may know. Now it’s distributed and load balanced to reduce the strain on the primary.

And if you’re curious, the sync source referred to in the doc can be checked in rs.status() and it can also be changed.

1 Like