I have problems importing data into mongodb with. I have a `test.json` file like this:
{"_id":{"s":{"$numberLong":"38851448"},"a":5},"someKey":"someValue"} {"_id":{"s":{"$numberLong":"38853194"},"a":5},"someKey":"someValue"} {"_id":{"s":{"$numberLong":"38760498"},"a":5},"someKey":"someValue"} {"_id":{"s":{"$numberLong":"39099662"},"a":5},"someKey":"someValue"} {"_id":{"s":{"$numberLong":"38855558"},"a":5},"someKey":"someValue"} {"_id":{"s":{"$numberLong":"38760487"},"a":5},"someKey":"someValue"} {"_id":{"s":{"$numberLong":"38760488"},"a":5},"someKey":"someValue"} {"_id":{"s":{"$numberLong":"39099663"},"a":5},"someKey":"someValue"} {"_id":{"s":{"$numberLong":"38851450"},"a":5},"someKey":"someValue"} {"_id":{"s":{"$numberLong":"38853546"},"a":5},"someKey":"someValue"}
I try to import it with following command:
mongoimport --type json --db test --collection coll --file test.json --upsert
The import fails almost always with the same error message:
2015-08-27T17:02:15.510+0200 error inserting documents: The _id field cannot be changed from {_id: { s: 38851448, a: 5 }} to {_id: { a: 5, s: 38851448 }}. 2015-08-27T17:02:15.511+0200 error inserting documents: The _id field cannot be changed from {_id: { a: 5, s: 38760487 }} to {_id: { s: 38760487, a: 5 }}.
The importer seems to change the order of the properties for `_id` for some of the documents.
I event tried to change the order of `s` and `a` in `_id`, but the problem stays the same.
If I trie to run the exact same import command with exactly the same datafile multiple times the documents with errors change and one time it imported all rows as expected, but just one time.
For completeness: I'm using mongo 3.0.5 on Mac OS X 10.10.5 installed by homebrew