Last Updated: February 25, 2016
·
484
· comerford

Limited Restoration of Deleted Documents in MongoDB

There is no built in way to un-delete documents that you have removed with MongoDB, but if you are running in Replica Set mode you have an oplog, and that means you may have options open to you (depending on how big the oplog is and how long ago you created/updated the documents in question).

This question (how can I restore documents I recently removed) was asked on StackOverflow, and I wrote up the answer with a very basic example to illustrate how this can be done:

http://stackoverflow.com/a/25809807/1148648