-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.0.4
-
Component/s: mongoimport
-
Environment:$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.8 (wheezy)
Release: 7.8
Codename: wheezy
When importing JSON files, mongoimport will randomly change the order of custom ID fields. Specifically, documents exported with mongoexport, then imported again with mongoimport will not end up identical. Since field order matters in mongoDB, these "shuffled" documents are not found anymore by our software, creating all kinds of problems. mongoimport is unusable for us as of now.
To reproduce, import the attached JSON file:
mongoimport -d test -c test --file test.json
The result is different every time. Here's one example:
> db.test.find();
{ "_id" :
, "d" : "test" }
{ "_id" :
, "d" : "test" }
{ "_id" :
, "d" : "test" }
{ "_id" :
, "d" : "test" }
{ "_id" :
, "d" : "test" }
{ "_id" :
, "d" : "test" }
{ "_id" :
, "d" : "test" }
{ "_id" :
, "d" : "test" }
{ "_id" :
, "d" : "test" }
Notice line 4 and 6 where the field order is wrong.
This behaviour was not observed in 2.x versions (although I cannot confirm at the moment).
- duplicates
-
TOOLS-894 mongoimport --upsert --type json with _id being an object does not work most of the times
- Closed