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

maxTimeMS is not supported as an option to MongoClient constructor

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major - P3
    • Resolution: Done
    • Affects Version/s: 3.6.4
    • Fix Version/s: None
    • Component/s: drivers
    • Labels:
    • Last comment by Customer:
      true
    • Story Points:
      1
    • Sprint:
      DET: In'n'Out (Jun 8 - Jun 22)

      Description

      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

       

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Days since reply:
              28 weeks, 5 days ago
              Date of 1st Reply: