문제

Am new to mongo db. I have a single json file which contains several documents.

When i try to upload the file through mongoimport, the file is considered as a single document to be created where as there are several documents to be created through the same file.

Below is import command.

mongoimport --db mydb --collection testData --type json --file var/www/html/orders.json --jsonArray

Running this command throws the following error:

exception:JSONArray file too large
도움이 되었습니까?

해결책

From MongoDB docs, always refer to docs before posting on stackoverflow:

--jsonArray Changed in version 2.2: The limit on document size increased from 4MB to 16MB.

Accept import of data expressed with multiple MongoDB documents within a single JSON array.

Use in conjunction with mongoexport --jsonArray to import data written as a single JSON array. Limited to imports of 16 MB or smaller.

다른 팁

Mongoimport is used to upload the JSON file into Mongodb. File should be in well formatted manner. MongoDB will limit to 16MB file.

mongoimport --host hosturl --port 27017 --username uname --password pwd --   collection collname --db marketing --file filepathwithFilename

Example Refference

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top