Contents
How does the mongorestore tool work in MongoDB?
The mongorestore tool imports content from binary database dump, created by mongodump into a specific database. mongorestore can import content to an existing database or create a new one. mongorestore only performs inserts into the existing database, and does not perform updates or upserts.
Where does the data come from in mongoestore?
The mongorestore program loads data from either a binary database dump created by mongodump or the standard input (starting in version 3.0.0) into a mongod or mongos instance.
How to restore a MongoDB backup using mongoestore?
The following example shows how to create a backup from a secure MongoDB database using mongodump and pass it as standard input to the mongorestore command to be restored in an insecure remote MongoDB instance. You can verify the restoration process by checking the databases with the remote server.
Which is the best version of mongoestore to use?
For example, if you used mongodump version 100.3.1 to create the dump, use mongorestore version 100.3.1 to restore it. mongorestore can create a new database or add data to an existing database. However, mongorestore performs inserts only and does not perform updates.
What happens when I restore a document to MongoDB?
That is, if restoring documents to an existing database and collection and existing documents have the same value _id field as the to-be-restored documents, mongorestore will not overwrite those documents. mongorestore recreates indexes recorded by mongodump.
How to run mongorestore against an Atlas cluster?
To run mongorestore against an Atlas cluster, you must specify a database user in the Atlas cluster that has the Atlas admin role. If no such user exists, create the user: If it is not already displayed, select your desired organization from the Organizations menu in the navigation bar.