-
-
Save fabien0102/88dcaa184d801fd5e67a to your computer and use it in GitHub Desktop.
ls -1 *.json | while read jsonfile; do mongoimport -d support -c logs -file $jsonfile --jsonArray -type json; done |
Cheers @fabien0102 this is still very relevant! Saved me a bunch of time!
when i tried to i got some eror like
2017-07-27T10:56:41.762-0400 error parsing command line options: unknown option "type"
2017-07-27T10:56:41.762-0400 try 'mongoimport --help' for more information
2017-07-27T10:56:41.770-0400 error parsing command line options: unknown option "type"
2017-07-27T10:56:41.770-0400 try 'mongoimport --help' for more information
how i can upload bunch of .jsonfiles from particular folder suppose my folder location is /home/hades3/Desktop/converter/ ,data base name 'test' and collection is docs.
do i need to change the .json files name in accordance with collection name like docs1,docs2,docs3....
The way at the moment is:
ls -1 *.json | while read jsonfile; do mongoimport -h <HOST> -d <DB> -c <COLLECTION> -u <username> -p <password> --file $jsonfile --jsonArray --type json; done
Missing some dashes.
how to execute script in windows machine?? As in command prompt linux command will not work
@fabien0102
Nice, thank you!