Non-unique key error handling

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.0
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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
            Reporter:
            Aristarkh Zagorodnikov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: