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

InsertOneAsync doesn't throw MongoDuplicateKeyException

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical - P2 Critical - P2
    • None
    • 2.2
    • Error Handling
    • None
    • Windows
    • 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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: