Let's say I have the following two JSONs, and I'd like to import them to the same collection without merging or updating the existing documents. Is there a way, to ignore the existing _id keys during import and end up with a single collection containing all the 6 documents of the example below?
The old _id properties have no relevance whatsoever. I could rename/remove them from the source files, I'm just curious if there is a way to do this during import.
coll1.json:
{"_id":1,"a":1}
{"_id":2,"a":2}
{"_id":3,"a":3}
and
coll2.json:
{"_id":1,"a":4}
{"_id":2,"a":5}
{"_id":3,"a":6}
If I simply import them, with mongoimport --db imp --collection imp --file coll2.json
I'm getting E11000 duplicate key error.