[JAVA-2407] MongoBulkWriteException E11000 duplicate key error collection Created: 11/Dec/16 Updated: 27/Oct/23 Resolved: 11/Dec/16 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | 3.4.0 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Mahmoud Kelany | Assignee: | Unassigned |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: | |||
| Backwards Compatibility: | Fully Compatible |
| Description |
|
com.mongodb.MongoBulkWriteException: Bulk write operation error on server localhost:27017. Write errors: [BulkWriteError{index=0, code=11000, message='E11000 duplicate key error collection: dbxxx.coll index: _id_ dup key: { : ObjectId('584d0561ccc8fa5203947cc2') }', details={ }}]. |
| Comments |
| Comment by Jeffrey Yemin [ 11/Dec/16 ] |
|
Without any more information to go on, I'd say this is expected behavior. The server is returning an error that a document with _id of ObjectId("584d0561ccc8fa5203947cc2") already exists in the collection, and the driver is reporting that error as an exception. Given that ObjectId instances are generally unique, the most likely explanation is that your application is inserting the same document twice. I'm closing this as Works as Designed, but if you have evidence of an issue with the driver or the server, we can re-open. |