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

Non-unique key error handling

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0
    • Component/s: None

      It appears that MongoCollection<TDocument>.InsertOneAsync throws a MongoWriteException which does not have any direct information about the kind of error happened, including non-unique key constraint violation. I checked the source and even single inserts are done via bulk write operations, which are inherently not very good at passing single-request error information. I was expecting MongoDuplicateKeyException to be thrown in case of such violation.
      Is this going to change, or should we ignore the existence of MongoDuplicateKeyException and try to interrogate inner exceptions which seems very unwieldy?

            Assignee:
            Unassigned Unassigned
            Reporter:
            onyxmaster Aristarkh Zagorodnikov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: