Skip to content

Unable to connect to Replica Set or Sharded Cluster #663

Open
@jukkakilponen

Description

@jukkakilponen

Steps to reproduce

Have a mongodb connection string with multiple hosts and ports (Replica Set or Sharded Cluster) as in https://www.mongodb.com/docs/manual/reference/connection-string/.
For example mongodb://mongos0.example.com:27017,mongos1.example.com:27017,mongos2.example.com:27017

Current Behavior

Cannot start the application. TypeError [ERR_INVALID_URL]: Invalid URL: mongodb://mongos0.example.com:27017,mongos1.example.com:27017,mongos2.example.com:27017

Expected Behavior

Should connect to database.

Additional information

Tested with 6.2.0.
The problem seems to be the use of nodejs URL to parse the connection string. The URL does not support multiple hosts with port numbers.
See whatwg/url#398.
Problem introduced in commit 1d8a84b.

Related Issues

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Current/Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions