Skip to content

bug: mongodb url with query params is incorrectly parsed #6389

@ruscon

Description

@ruscon

Issue type:

[x] bug report

Database system/driver:

[x] mongodb

TypeORM version:

[x] the bug is reproduced starting from 0.2.25 (0.2.24 is OK)

Steps to reproduce or a small repository showing the problem:

Mongo DB URL without query params is OK
TYPEORM_URL = mongodb://127.0.0.1:27017/testing
the database called testing will be created

Mongo DB URL with query params (bug)
TYPEORM_URL = mongodb://127.0.0.1:27017/testing?readPreference=primary&appName=xxx
the database called testing?readPreference=primary&appName=xxx will be created

The bug appeared in this commit (src/connection/Connection.ts:538):
ed75d59#diff-9ada25e7bb500fdf98eeb214f7c94e9aR538

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions