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

Calling connect() twice on instance of MongoClient produces warnings

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.3.3
    • Component/s: Native
    • Environment:
      node v10.16.3

      Code snippet:

      const { MongoClient } = require('mongodb');
      
      (async () => {
          const client = await new MongoClient('mongodb://localhost:27017', { useUnifiedTopology: true });
          await client.connect();
          await client.close();
          console.log('First connection worked fine.');
          await client.connect();
          await client.close();
          console.log('Second connection created errors.');
      })();
      
      

      Issue occurs even though close() was called inbetween to close the connection.

      Output:

      First connection worked fine.
      the options [servers] is not supported
      the options [caseTranslate] is not supported
      the options [dbName] is not supported
      Second connection created errors.Process finished with exit code 0
      

            Assignee:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Reporter:
            tiacobescu@bitdefender.com Iacobescu Tudor
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: