Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1390

InsertOneAsync doesn't throw MongoDuplicateKeyException

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 2.2
    • Component/s: Error Handling
    • None
    • Environment:
      Windows
    • Minor Change

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            veleek Benjamin Randall
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: