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

ChangeStreams.watch methods not respecting maxAwaitTimeMS

    • 2
    • Not Needed

      What problem are you facing?

      maxTimeMS or maxAwaitTimeMS are not passed through to getMore or aggregate calls for change streams, resulting in the server default always being used.

      Steps to reproduce?

      1. Spin up a new replica set
      2. Update the script below with the correct connection string
      3. Run the script and observe than neither maxAwaitTimeMS or maxAwaitMS get sent in any of the commands
      import { MongoClient } from './src';
      
      async function main() {
          const client = new MongoClient(
            'mongodb://bob:pwd123@localhost:31000,localhost:31001,localhost:31002/?replicaSet=rs',
            { monitorCommands: true }
          );
      
          client.on('commandStarted', ({ command }) => console.debug(command));  
      
          await client.connect();
          const cs = client
             .db('test')
             .collection('test')
             .watch([], { maxAwaitTimeMS: 4000, maxTimeMS: 6000 });
      
          cs.on('change', console.log);
      }
      
      main();
      
      

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            bailey.pearson@mongodb.com Bailey Pearson
            Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: