I have a large json file (350GB) and I am trying to import it in MongoDB collection using mongoimport.The mongoimport is very very slow and I am not sure how many days it will take.
Can any one please suggest the best way to load this json file to mongodb collection. I have enough disk space to load this json file.
I came across similar situation. I used
mongorestore
instead ofmongoimport
but the idea is the same.iotop
shows that the restore process had an IO rate of about 1M/s which is pretty low. As other post here suggests, the low performance is probably due to the json to bson serialization. So I ended splitting up the exported json file into different chunks with the following commandthen I ended up having 7 chunks. Finally import these chunks in parallel using mongorestore with following command.