Monday, February 17, 2014

Load all json files from folder to MondoDB

Here is one way to quickly load number of json files to DB (MongoDB) for quick data mining:


ls -1 *.json | sed 's/.json$//' | while read col; do
   ./mongoimport -h --db mytests --collection news --file $col.json --jsonArray

SQL to investigate data, "news" is collection, 'Headline' is filed in json:{Headline: {$regex: " for period end .*"}},  {Headline:1, _id:0})


No comments:

Post a Comment