bulkWrite inside a session with timeoutMS set on the connection throws error

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Bulk API, CSOT
    • 3
    • None
    • 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?
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      As a... nodejs driver user
      I want... to be able to use the bulkWrite inside a session with a global timeoutMS

       

      This is the minimal code needed to reproduce the bug.

       

      const { MongoClient } = require('mongodb');
      
      require('dotenv').config({ quiet: true });
      
      (async () => {
          const client = new MongoClient(process.env.MONGO_DB_URL, { timeoutMS: 1000 });
          await client.connect();
          const collection = client.db('parakey-development').collection('Test');
          const session = await client.startSession();
          await session.withTransaction(async () => {
              const result = await collection.bulkWrite([
                  {
                      insertOne: {
                          document: {
                              name: 'Test 1'
                          }
                      }
                  }
              ], {
                  session
              });
              console.log(result);
          });
      })();
      

      You'll find a complete repo here with the environment: https://github.com/Falsen/mongodb-driver-bug

       

       

      User Experience

      • What is the desired/expected outcome for the user once this ticket is implemented?
      • If bug: What is the number of impacted customers? How severe is the impact? Is anyone blocked or broken?

      Dependencies

      • n/a

      Risks/Unknowns

      • n/a

      Acceptance Criteria

      Implementation Requirements

      • Allow bulkWrites in sessions when timeoutMS has been set on the client

      Testing Requirements

      • n/a

      Documentation Requirements

      • n/a

      Follow Up Requirements

      • n/a

            Assignee:
            Unassigned
            Reporter:
            Albin Falsen
            None
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: