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

useNewUrlParser does not seem to work

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.1.0
    • Component/s: MongoDB 3.4
    • Environment:
      osx 10.13.5
      node: 10.5.0
      mongodb: 3.1.0
      mongodb-core: 3.1.0

      Consider the following code:

       

      const MongoClient = require('mongodb').MongoClient;
      const assert = require('assert');
      const url = 'mongodb://user:password@p0.mongodb.net:27017,p1.mongodb.net:27017,p2.mongodb.net:27017/mydatabase?replicaSet=project-0&authSource=admin&ssl=true';
      
      MongoClient.connect(url, { useNewUrlParser: true }, (err, client) => {
        assert.equal(null, err);
        console.log('Connected successfully to server');
        client.close();  
      });
      

       

      This currently throws 

      MongoError: seed list contains no mongos proxies, replicaset connections requires the parameter replicaSet to be supplied in the URI or options object, mongodb://server:port/db?replicaSet=name

       

      However, if changing useNewUrlParser to false, it works, but shows the Deprecation warning:

      (node:11481) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.

       

      I am unable to find something wrong with the URL format. 

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            alex.stanciu@auth0.com Alex Stanciu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: