Created
March 24, 2019 01:20
-
-
Save bcmarinacci/9ac005b1655c45bd9f22c29ce918052f to your computer and use it in GitHub Desktop.
Pipe mongodump into mongorestore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mongodump \ | |
| --host "${ORIGIN_HOST}" \ | |
| --db "${ORIGIN_DB}" \ | |
| --username "${ORIGIN_USERNAME}" \ | |
| --password "${ORIGIN_PASSWORD}" \ | |
| --authenticationDatabase 'admin' \ | |
| --collection "${COLLECTION}" \ | |
| -vvv \ | |
| --gzip \ | |
| --archive | | |
| mongorestore \ | |
| --host "${TARGET_HOST}" \ | |
| --db "${TARGET_DB}" \ | |
| --username "${TARGET_USERNAME}" \ | |
| --password "${TARGET_PASSWORD}" \ | |
| --authenticationDatabase 'admin' \ | |
| --nsInclude "${ORIGIN_DB}.${COLLECTION}" \ | |
| --nsFrom "${ORIGIN_DB}.${COLLECTION}" \ | |
| --nsTo "${TARGET_DB}.${COLLECTION}" \ | |
| --drop \ | |
| --objcheck \ | |
| --stopOnError \ | |
| -vvv \ | |
| --gzip \ | |
| --archive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment