-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: mongoimport
-
Not Needed
The list of documents below contains a duplicate _id. mongoimport correctly flags this as an error, but claims the document was imported into the collection.
$ cat export.js
{ "_id" : { "$oid" : "53c833593206b4df88d74ca7" }, "x" : "a" }
{ "_id" : { "$oid" : "53c833593206b4df88d74ca7" }, "x" : "b" }
{ "_id" : { "$oid" : "53c833593206b4df88d74ca8" }, "x" : "c" }
{ "_id" : { "$oid" : "53c833593206b4df88d74ca9" }, "x" : "d" }
$ mongoimport --version
mongoimport version: 2.7.8
$ mongoimport --drop -d test -c foo < export.js
2014-11-07T11:53:31.618-0500 connected to: localhost
2014-11-07T11:53:31.618-0500 dropping: test.foo
2014-11-07T11:53:31.621-0500 error inserting documents: insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.foo.$_id_ dup key: { : ObjectId('53c833593206b4df88d74ca7') }
2014-11-07T11:53:31.621-0500 imported 4 documents
$ mongo --eval 'db.foo.count()'
MongoDB shell version: 2.7.8
connecting to: test
3
- is duplicated by
-
SERVER-18089 Mongoimport claims it imported 0 documents when it successfully imports.
-
- Closed
-
-
TOOLS-293 capture accurate count of docs inserted from a bulk write in case of error
-
- Closed
-
- is related to
-
TOOLS-65 mongoimport stopOnError does not stop on error (legacy C++)
-
- Closed
-
- related to
-
TOOLS-1199 Backport to v3.2
-
- Closed
-
-
TOOLS-1126 mongoimport ignores authentication errors, reports successful import
-
- Closed
-
-
TOOLS-2010 mongoimport may report incorrect number of imported documents
-
- Closed
-