Last active
August 27, 2020 11:01
-
-
Save olecksamdr/aaeb00dda1e5623899040f2dc98857a3 to your computer and use it in GitHub Desktop.
Dump several collections from mongodb server
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
collections=( collectionName1 collectionName2 collectionName3 collectionName4 ) | |
for c in ${collections[@]} | |
do | |
mongodump \ | |
--uri "..." \ | |
--collection=$c \ | |
--out "$(pwd)/staging/$(date +"%m-%d-%y")" | |
done |
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
mongorestore \ | |
--uri "mongodb://localhost:27017" \ | |
-d $S_DBDATABASE \ | |
"$(pwd)/staging/08-27-20/dbName" \ | |
--drop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment