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

Investigate NODE-3917 - 4.x driver allows directConnection=true with multiple hosts

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • 0
    • Not Needed

      NODE-3917 Description
      https://github.com/mongodb/specifications/blob/master/source/uri-options/uri-options.rst#directconnection-uri-option-with-multiple-seeds-or-srv-uri says:

      The driver MUST report an error if the directConnection=true URI option is specified with multiple seeds.

      In reality:

      import { MongoClient } from 'mongodb';
      
      const url = 'mongodb://localhost:27017,localhost:27018,localhost:27019/?directConnection=true&replicaSet=replset';
      const client = await MongoClient.connect(url);
      console.log((await client.db('admin').command({ hello: 1 })).hosts);
      

      prints [ 'localhost:27017', 'localhost:27018', 'localhost:27019' ] with the 4.3.0 driver. With 3.7.3, this fails as expected (“directConnection option requires exactly one host”).

            Assignee:
            Unassigned Unassigned
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: