Needless to say this or any other recovery technique should be ideally done in a staging area on a backup copy of the database file. This BSON is a python object now and can be dumped into a recover collection or simply logged somewhere. We will insert 100 documents without a name field and 100 documents with an identical name field so that they can be mistakenly removed later: use dropTest įor(i=0 i db.foo.remove(] ShubhamRanjan (Shubham Ranjan) January 15, 2020, 10:21am 3 Hi Divya26030, Compass has some limitations. The basic logic remains the same.įirst, let's create our example collection foo in the database dropTest. Can we update/delete multiple documents on compass 007jb (O Brown) January 14, 2020, 11:15pm 2 I have the latest stable version of Compass (1.20.4) and it’s still not possible. 3 Now that you know: How to install MongoDB on windows How to create and handle documents Let’s try to move things further, How so Let’s discover how we can query our documents. To go beyond this (huge number of documents, or perhaps you wish to only selectively restore etc.) you will either want to change the code to iterate over a cursor or write this using your language of choice outside the MongoDB shell. I will use a simplified example with just 100 deleted documents that need to be restored. The easiest way to illustrate this is with an example. With an oplog that covers when the documents were inserted, you may be able to recover them. With that said however, if you are running a replica set, even a single node replica set, then you have an oplog. documents have been properly moved, you can then delete those documents. There is no rollback option ( rollback has a different meaning in a MongoDB context), and strictly speaking there is no supported way to get these documents back - the precautions you can/should take are covered in the comments. Reach new heights in your career with MongoDB (English Edition) Justin Jenkins.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |