-
-
Save yuswitayudi/a12fa3869068c777893c21422e4cb32f to your computer and use it in GitHub Desktop.
Dump multiple collections of a db in mongodb
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
#!/bin/bash | |
db=<db> | |
collection_list="<collection1> <collection2> <collection3>" | |
host=127.0.0.1 | |
port=<port> | |
out_prefix=/Temp | |
for collection in $collection_list; do | |
echo $collection | |
out_dir="${out_prefix}/${db}_${collection}/" | |
mkdir -p ${out_dir} | |
mongodump --host $host --port $port --collection $collection --db $db --out ${out_dir} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment