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

Add alternative transaction API that doesn't require passing a session to each method

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Transactions
    • 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?

      How are you using Mongo? What version of the server and driver are you using?

      I work on the Node driver, and I test and work with all supported server and driver versions

      This feature is client-side only, probably not something we'd backport so only relevant to 6.x drivers.

      What is the feature/improvement you would like?

      Add an alternative `withTransaction` API that wouldn't require users to pass a session in to each operation.  Maybe something like this:

      client.withTransaction2(async (client: TransactionMongoClient) => {
        // client is a specialized client that stores the current session,
        // so each operation can obtain the session from the client/db/collection
        // instead of passing it explicitly into the API
        await client.db('foo').collection('bar').insertOne({});
      });

      What use case would this feature/improvement enable?

      This would simplify our convenient transactions API for users.

            Assignee:
            Unassigned Unassigned
            Reporter:
            bailey.pearson@mongodb.com Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: