Skip to content

Instantly share code, notes, and snippets.

@devtin
Last active January 6, 2022 14:15
Show Gist options
  • Save devtin/9ab5b5bc63d6f2cd4163998d55578564 to your computer and use it in GitHub Desktop.
Save devtin/9ab5b5bc63d6f2cd4163998d55578564 to your computer and use it in GitHub Desktop.
mongoDb collection backup
#!/usr/bin/env bash
SRC_URI=<source-connection-uri>
SRC_DB=<source-database-name>
DST_URI=<destination-connection-uri>
DST_DB=<destination-database-name>
FLOW=1000
mongodump --archive --uri $SRC_URI --db $SRC_DB | mongorestore --archive --uri $DST_URI --db $DST_DB --numInsertionWorkersPerCollection=$FLOW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment