As my experience, you should try mongoimport. Then, you can import your JSON like as follows
// --jsonArray output to a json array rather than one object per line
mongoimport -d dbName -c collectionNameYouLike --file your.json --jsonArray
Besides, mongoimport seems to have some format requirements about JSON.
It should be like (one json object in one line)
{"houseno":"12345678","location":"India"}
{"houseno":"1245678","location":"UK"}
instead of
{
"houseno":"12345678",
"location":"India"
}
{
"houseno":"1245678",
"location":"UK"
}
If you omit --jsonArray
option, the terminal will complain. Sorry, after writing it down, I find another similar post that might help:
mongodb json import.
Anyway, hope it helps. My MongoDB version is 2.6.6.