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

Make withTransaction use async await syntax

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 6.5.1
    • Affects Version/s: 5.0.0
    • Component/s: None
    • 3
    • 0
    • Not Needed
    • 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?

      Use Case

      Async/await syntax has certain performance benefits over manual promise manipulation it would be nice to obtain those gains where we can. One instance in our driver of being a promise only interface is withTransaction.

      Unknowns

      • How deep can the async await syntax go?
        • (update: Feb 28, 2024) We have converted more of the internals of the driver, we should be able to completely convert the API to async/await

      Acceptance Criteria

      Implementation Requirements
      • Change promise using transaction code to use async/await
        • withTransaction
        • attemptTransaction
        • attemptTransactionCommit
        • abortTransaction
        • endTransaction
      • Remove endTransactionAsync (endTransaction will take its place)
      Testing Requirements
      • Might be interesting to see if there's a measurable difference in performance but it is probably out weighed by actual operations of a transaction. Maybe stubbing the lower layers to just test the JS part of this.
      Documentation Requirements
      Follow Up Requirements

            Assignee:
            aditi.khare@mongodb.com Aditi Khare
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Warren James
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: