Skip to content

Instantly share code, notes, and snippets.

@girish3
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save girish3/37eec58d2d7abcf4fd32 to your computer and use it in GitHub Desktop.
Save girish3/37eec58d2d7abcf4fd32 to your computer and use it in GitHub Desktop.
how to migrate local mongdb database to mongolab(or any remote server)
# your backup folder
cd /backup
# make sure mongod instance is running
mongodump --db dbname --out ./
# above line will create a folder dbname
cd dbname
# migrate to mongolab
mongorestore -h ds11111.mongolab.com:61111 -d joke_db -u username -p password ./
# if you want to restore to a local db, default host(-h) is localhost
mongorestore -d joke_db -u username -p password <input directory>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment