We had a downloaded MongoDB dump that we wanted to restore on cloud.MongoDB.com. This is how we did it:
-
Download the backup via the MongoDB web UI.
-
Unzip it. In this example we assume it unzipped to
/tmp/foo
. -
Have MongoDB installed locally, e.g. via:
brew tap mongodb/brew brew install mongodb-community
-
Start a local Mongo server:
mongod --dbpath /tmp/foo
-
Dump the local Mongo server (will create a
dump
directory in the current working directory):mongodump
-
Restore the remote DB from this dump:
mongorestore --uri mongodb+srv://myuser:[email protected]/ --drop dump
Note that
--drop
only drops the same collections as you're importing! Any collections that aren't in your local dump will remain in the remote DB unless you wipe it first.We just removed the collections one by one via their web UI, but please comment with better solutions.