Skip to content

Instantly share code, notes, and snippets.

@Nyahua
Created March 28, 2017 15:13
Show Gist options
  • Save Nyahua/f33e7b4d461be83b70bf8b0f0c307854 to your computer and use it in GitHub Desktop.
Save Nyahua/f33e7b4d461be83b70bf8b0f0c307854 to your computer and use it in GitHub Desktop.
mongodump --db=<old_db_name> --collection=<collection_name> --out=data_directory/
tar -zcvf archive.tar.gz data_directory/ 

mongorestore --db=<new_db_name> --collection=<collection_name> data/<db_name>/<collection_name>.bson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment