Mongorestore of oplog collection fails if it includes view creation


I periodically take dump of the oplog collection and during restore I apply it using mongorestore utility.
If I have a view creation, which is captured by oplog backup and if I try to restore it, it fails with below error.
Please can someone help to resolve it and restore views.

root@tepalteubuntu1804:/home/admin# "/usr/bin/mongorestore" --port 27017  --oplogReplay "/local/oplog_replay_input"
2021-03-05T09:53:53.936+0000    preparing collections to restore from
2021-03-05T09:53:53.937+0000    replaying oplog
2021-03-05T09:53:53.940+0000    **Failed: restore error: error applying oplog: applyOps: (Location51070) Modifications to system.views must take an exclusive lock**
2021-03-05T09:53:53.940+0000    0 document(s) restored successfully. 0 document(s) failed to restore.

Akshaya Srinivasan

Hi @Akshaya_Srinivasan,

Which versions of mongod and mongorestore are you running?

It looks like this has been fixed in 4.2.10, 4.4.2 and 4.7.0 (dev version, future 5.0 I think).


I am using 4.2.8 version mongod and mongorestore. Will try with 4.2.10 and update.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.