Created
October 12, 2016 13:52
-
-
Save Technowise/90997242fa874a38e3b347e0fcbc3f6e to your computer and use it in GitHub Desktop.
Shell script to import all MongoDB json files in current folder to remote database
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
ls -1 *.json | sed 's/.json$//' | while read col; do | |
mongoimport --host sample-mongodb-host.com --username john --password sample-password --db sample-db --collection $col --file $col.json | |
echo $cmd | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment