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

XMLWordPrintableJSON

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

      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
              Reporter:
              TPM Jira Automations Bot
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: