MongoDB & NoSQL (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What is the Oplog (Operations Log) in MongoDB?
senior LevelSystem DesignDatabases & SQL
In Simple Words:
The oplog.rs is a special capped collection that records a rolling, chronological history of all data modification writes:
- Every insert, update, or delete on the Primary is converted into an idempotent operation and appended to the oplog.
- Secondary nodes tail the Primary's oplog and apply events to stay synchronized.
- Oplog Window: The duration of time covered by the oplog. If a secondary goes offline longer than the oplog window, it falls out of sync and requires a full initial resync.