Created
March 13, 2017 14:08
-
-
Save juanem1/aed3278f596ef0668a0543d325e4d930 to your computer and use it in GitHub Desktop.
Import multiple json files to MongoDB
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 | |
FILES=./* | |
# loop over all files in this directory | |
for f in $FILES | |
do | |
# Import each file | |
# Mongoimport will use file name as collection name | |
mongoimport -h localhost:7880 -d databaseName --file $f | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment