Skip to content

Instantly share code, notes, and snippets.

@DaniiNyan
Created December 8, 2020 12:11
Show Gist options
  • Save DaniiNyan/bbbfa0c944e63648a3ae67f2ed6e2e09 to your computer and use it in GitHub Desktop.
Save DaniiNyan/bbbfa0c944e63648a3ae67f2ed6e2e09 to your computer and use it in GitHub Desktop.

Import database:

  • JSON:
mongoimport --uri "<Atlas Cluster URI>"
            --drop=<filename>.json
  • BSON:
mongorestore --uri "<Atlas Cluster URI>"
             --drop dump

Export database:

  • JSON:
mongoexport --uri "<Atlas Cluster URI>"
            --collection=<collection name>
            --out=<filename>.json
  • BSON:
mongodump --uri "<Atlas Cluster URI>"

URI = Uniform Resource Identifier

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