# BASH ### Mongo Dump ```bash! #!/bin/bash MONGO_DUMP_PATH="/media/kubuntu/Backup2/dump/" echo "mongo_uri:" read mongo_uri if [[ "$mongo_uri" = "68" ]]; then uri="mongodb://ktht:123456@172.27.17.68:27017" elif [[ "$mongo_uri" = "70" ]]; then uri="mongodb://ktht:123456@172.27.17.70:27017" else uri="mongodb://ktht:ktht8inf@172.27.17.72:27017" fi echo "database:" read db echo "collection:" read collection mongodump $uri --db $db --collection $collection --out $MONGO_DUMP_PATH ``` ### Mongo Restore ```bash! #!/bin/bash MONGO_DUMP_PATH="/media/kubuntu/Backup2/dump" echo "database:" read db echo "collection:" read collection mongorestore --port 27017 --db $db --collection $collection $MONGO_DUMP_PATH/$db/$collection.bson --drop db="" collection="" mongorestore --port 27017 --db $db --collection $collection $MONGO_DUMP_PATH/$db/$collection.bson --drop ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up