Skip to content

Instantly share code, notes, and snippets.

@dineshsprabu
Created February 13, 2016 12:09
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 dineshsprabu/06f2ede79753ff4f43f5 to your computer and use it in GitHub Desktop.
Save dineshsprabu/06f2ede79753ff4f43f5 to your computer and use it in GitHub Desktop.
[Mongo] Backup and Restore Mongo DB and Collection
/* dumping a particular collection */
mongodump --host 127.0.0.1 --port 27017 --out <backup-path> --db '<db-name>' --collection '<collection-name>'
/* dumping the entire DB */
mongodump --host 127.0.0.1 --port 27017 --out <backup-path> --db <db-name>
/* restoring backup/dump */
mongorestore --host 127.0.0.1 --port 27017 <backup-path>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment