Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save anhnt/64380ecd69efd129b9d239fd54523c16 to your computer and use it in GitHub Desktop.

Select an option

Save anhnt/64380ecd69efd129b9d239fd54523c16 to your computer and use it in GitHub Desktop.
Mongodb restore and dump commands via json, bson and csv

Binary

Import database mongorestore -h ds041871.mongolab.com:41871 -d azdms -u -p Export database mongodump -h ds041871.mongolab.com:41871 -d azdms -u -p -o Import collection mongorestore -h ds041871.mongolab.com:41871 -d azdms -u -p <input .bson file> Export collection mongodump -h ds041871.mongolab.com:41871 -d azdms -c -u -p -o

JSON

Import collection mongoimport -h ds041871.mongolab.com:41871 -d azdms -c -u -p --file Export collection mongoexport -h ds041871.mongolab.com:41871 -d azdms -c -u -p -o

CSV

Import collection mongoimport -h ds041871.mongolab.com:41871 -d azdms -c -u -p --file <input .csv file> --type csv --headerline Export collection mongoexport -h ds041871.mongolab.com:41871 -d azdms -c -u -p -o <output .csv file> --csv -f

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