Last active
February 6, 2024 00:00
-
-
Save myctw/b6aa3b80316b029c2048e63733115cc8 to your computer and use it in GitHub Desktop.
Mongodb dump multiple collections script
This file contains 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 | |
host=127.0.0.1 | |
port=27017 | |
authDB=admin | |
db=[YourDB] | |
user=root | |
pwd=[YourPassword] | |
collections="[Collection1] [Collection2]" | |
output_folder="./export/" | |
for collection in $collections; do | |
echo $collection | |
mongodump --host $host --port $port -u $user -p $pwd --authenticationDatabase $authDB --collection $collection --db $db --out ${output_folder} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment