Skip to main content

How does MongoDB internally manage oplog entries during replication?

Senior MongoDB
Quick Answer The oplog is a capped collection. Each entry records a write operation (with document data for idempotent replay). Secondaries tail the primary oplog and apply entries. If a secondary falls too far behind (oplog is overwritten before secondary catches up), the secondary goes into RECOVERING state and needs full resync. Size oplog large enough to cover expected lag and maintenance windows.

Answer

The primary writes operations to the oplog; secondaries tail the oplog and apply changes in timestamp order for consistent replication.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice