Answer
Restoring a partial snapshot with mongorestore does not break the MongoDB oplog sequence itself, but it can create a temporary mismatch between the document states written by the restore and the existing oplog entries. Meteor’s reactive system will continue to tail the oplog; until those entries are processed, clients may see stale data or mismatch warnings in the server logs.
Confirmed facts
- Meteor only receives real‑time updates by tailing the
local.oplog.rs collection when MongoDB runs as a replica set.
- A standard
mongorestore of user databases does not touch the local database, so the oplog continues from its current position.
- If the restored data lacks a document version that an existing oplog entry expects, Meteor logs an oplog mismatch until that entry is applied or the server restarts to reset the tailing cursor.
- Stopping the Meteor app, performing the restore, and then restarting Meteor forces it to begin tailing from the oplog’s current head, clearing any stale cache.
Likely explanation of the temporary impact
When an older version of a document is written over a newer version by mongorestore, the oplog already contains entries that describe the newer state. Meteor will apply those entries after the restore, potentially overwriting the restored older data with the newer state. During the window between the restore and the processing of those oplog entries, Meteor’s internal cache may hold the older version, causing clients to see out‑of‑date data or temporary inconsistency warnings.
Steps to maintain synchronization
- Stop the Meteor application (
meteor stop or equivalent process manager).
- Run the partial restore, for example:
mongorestore --drop --db mydb --collection users /path/to/dump/mydb/users.bson
- (Optional) If you want to discard any oplog entries that could cause mismatches, drop the oplog and let the replica set resync:
use local
db.oplog.rs.drop()
- Start the Meteor application again (
meteor or restart via your process manager).
- Verify that oplog tailing has resumed and that updates flow to clients.
Verification
- Check Meteor logs for lines like “Oplog tailing started” or “Connected to MongoDB” after restart.
- In the MongoDB shell run
rs.printReplicationInfo() to confirm the oplog has recent timestamps and has not been truncated unexpectedly.
- Insert a test document into a restored collection and observe the change appear in connected clients in real time (e.g., via browser console).
Missing diagnostic detail
If you are unsure whether the oplog still contains enough recent entries to cover the window between the restore and the Meteor restart, check the age of the newest oplog entry relative to the restore point:
use local
db.oplog.rs.find().sort({$natural:-1}).limit(1).ts
If the oplog’s head is older than the restore by more than your oplog size window, consider resetting the oplog as shown above.