mongodb - Imports to Mongo limited to 16MB if using jsonArray -


i using mongo 2.6.1. want import data json file > 16 mb. json array of documents. according documentation if use --jsonarray option, file can 16mb, see http://docs.mongodb.org/manual/reference/program/mongoimport/

strangely, have managed import data > 16 mb (24mb) no problem using mongoimport, doing:

mongoimport -db mydb --collection product --file products.json --jsonarray 

so 16mb limit then?

16 mb mongodb bson document size limit. means no document inside mongodb exceed 16 mb.

note json representation of mongodb document exceed limit, since bson more compact.

the problem --jsonarray flag mongoimport reads whole .json file single document first, , performs import on each of elements, suffering bson document size limit.

solution new mongodb versions (2.5.x , later)

i tested mongoimport latest mongodb 2.6.4 using large json array (~200 mb) , worked perfectly.

i'm pretty sure such operation impossible mongodb 2.2.x. so, looks mongodb.org forgot update mongoimport documentation.

i searched mongodb bug tracker , found issue. according it, problem resolved year ago , fix released mongodb 2.5.0.

so, feel free import large json documents!

solution old mongodb versions (prior 2.5.0)

if you're using old version of mongodb, it's still possible import large array of documents, using --type json flag instead of --jsonarray. assumes special structure file import from. it's similar json format, except 1 document per line allowed no comma after each of them:

{ name: "widget 1", desc: "this widget 1" } { name: "widget 2", desc: "this widget 2" } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -