-
Type: Bug
-
Resolution: Fixed
-
Priority: 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
-
(copied to CRM)
-
Empty show more show less
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.