Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5659

Driver retries a transaction operation when a DuplicateKeyError is hit

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 5.8.1, 6.1.0
    • Component/s: Transactions
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      What problem are you facing?

      I hit this issue in a test where I attempt to insert multiple copies of the same document in a single transaction. I can see that one of the insert operations fails with a DuplicateKeyError, but it seems that when the transaction is run using the driver's `withTransaction` wrapper, it keeps retrying the transaction even though the error shouldn't really be considered "transient" (ie. this operation will always fail no matter what)

      What driver and relevant dependency versions are you using?

      Primarily tested on driver version 5.8.1 using Mongoose with version 7.5.0, but I also did a quick test on 6.1.0 to see if the issue still presents itself.

      Steps to reproduce?

      Use the `withTransaction` wrapper and perform two identical write operations on the same collection which include the same _id (or another duplicate piece of information which has a unique index, this is the case I'm hitting)

            Assignee:
            Unassigned Unassigned
            Reporter:
            adam@taplytics.com Adam Wootton
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: