How to use mongorestore to restore mongodb database
After dumping the mongodb database named “firstdb” in the previous tutorial, we can use mongorestore command in the command prompt to restore the “firstdb” database to mongolab.
But first you have to create an empty “firstdb” database in mongolab and set up an user and password for that database as described in the getting start with mongodb tutorial.
In the command prompt navigate to location where mongodb shell is installed. In our tutorial, it was installed in c:\Program Files\mongodb_2.4.8\
Type the command …
mongorestore –host ds0xxxxxx.mongolab.com –port xxxxx –db firstdb –username firstuser –password ****** dump/firstdb/
The last parameter “dump/firstdb/” is the path where the dump files are located.