[CSHARP-1390] InsertOneAsync doesn't throw MongoDuplicateKeyException Created: 27/Aug/15  Updated: 26/Jan/16  Resolved: 26/Jan/16

Status: Closed
Project: C# Driver
Component/s: Error Handling
Affects Version/s: 2.2
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Benjamin Randall Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows


Issue Links:
Duplicate
duplicates CSHARP-1236 Non-unique key error handling Closed
Backwards Compatibility: Minor Change

 Description   

When calling InsertOneAsync with a duplicate key, you get a MongoWriteException. By digging into the WriteError and looking at the code you can determine what the actual failure is, but this behavior is different from something like ReplaceOneAsync which thrown a DuplicateKeyException.



 Comments   
Comment by Aristarkh Zagorodnikov [ 26/Jan/16 ]

I believe that the reason is described in CSHARP-1236.

Generated at Wed Feb 07 21:39:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.