Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-14237

maxTimeMS is not supported as an option to MongoClient constructor

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.4
    • Component/s: drivers
    • Labels:

      Hi Team

      Here https://docs.mongodb.com/drivers/node/faq/#how-can-i-prevent-long-running-operations-from-slowing-down-the-server- it is mentioned that one can pass maxTimeMS option setting in MongoClient constructor to apply this to all the operations called by the client but on using this option it is showing this message:

      the options [maxTimeMS] is not supported
      

       
      Script:

      const mongodb = require('mongodb');
      const { MongoClient } = mongodb;
      const client = new MongoClient('mongodb://localhost:27017/db', {
          maxTimeMS: 1000,
          useUnifiedTopology: true
      });
      client.connect().then(() => {
          console.log('connected');
      })
      .catch(err => console.error('connection err:', err))
      .finally(() => {
          client.close();
      });
      

      Mongodb driver version: 3.6.4
      NodeJs version: 12.6.1
      Platform: MacOS Big Sur

       

            Assignee:
            kailie.yuan@mongodb.com Kailie Yuan
            Reporter:
            rajat.malhotra@vedantu.com Rajat Malhotra
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              2 years, 41 weeks, 1 day ago