Skip to content

Instantly share code, notes, and snippets.

@juanem1
Created March 13, 2017 14:08
Show Gist options
  • Save juanem1/aed3278f596ef0668a0543d325e4d930 to your computer and use it in GitHub Desktop.
Save juanem1/aed3278f596ef0668a0543d325e4d930 to your computer and use it in GitHub Desktop.
Import multiple json files to MongoDB
#!/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