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

maxTimeMS is not supported as an option to MongoClient constructor

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major - P3
    • Resolution: Done
    • 3.6.4
    • None
    • drivers
    • 1
    • DET: In'n'Out (Jun 8 - Jun 22)
    • true

    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

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

            Dates

              Created:
              Updated:
              Resolved:
              1 year, 22 weeks, 2 days ago