[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: |
|
||||||||
| 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 |