Update docs for withTransaction

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Lambda
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      https://mongodb.github.io/node-mongodb-native/3.3/api/ClientSession.html#withTransaction says: 
      IMPORTANT: This method requires the user to return a Promise, all lambdas that do not
      return a Promise will result in undefined behavior.

      The first Node.js example on https://docs.mongodb.com/manual/core/transactions/index.html says:

      // Note: The callback for withTransaction MUST be async and/or return a Promise.

      The example uses an async function and does not return a Promise.  I've tried this out and it's working for me. 

       

      I think the driver docs need to be updated to indicate the function can be async or return a promise. 

            Assignee:
            Matt Broadstone
            Reporter:
            Lauren Schaefer
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: