Skip to content

new URL() in error handling fails on valid MongoDB connection strings with multiple hosts #58

@Botik

Description

@Botik

In MongoClient.ts:22, when catching connection errors, the code attempts to parse the URL using new URL(url) to extract the hostname for the error message. However, this fails for valid MongoDB connection strings that contain multiple comma-separated hosts, such as:

mongodb://host1.example.com:27018,host2.example.com:27018,host3.example.com:27018/mydb

This URL format is valid for MongoDB clients but throws a TypeError when passed to the standard URL constructor because the comma-separated hosts are not a valid URL path component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions