how to import large json file into mongodb using mongoimport?

naveen_sfx picture naveen_sfx · Jul 2, 2014 · Viewed 14k times · Source

I am trying to import the large data set json file into mongodb using mongoimport.

mongoimport --db test --collection sam1 --file 1234.json --jsonArray

error:
2014-07-02T15:57:16.406+0530 error: object to insert too large
2014-07-02T15:57:16.406+0530 tried to import 1 objects

Answer

Juliano Galgaro picture Juliano Galgaro · Nov 29, 2015

Please try add this option: --batchSize 1

Like:

mongoimport --db test --collection sam1 --file 1234.json --batchSize 1

Data will be parsed and stored into the database batchwise