Skip to content

URL DB Parsing Fails for +SRV URLs #1977

Closed
@derekrprice

Description

@derekrprice

My Mongo DSN looks like mongodb+srv://mongo:27017/dbname. Using this configuration yields an error about "$databaseName is not defined":

'mongo' => [
    'driver' => 'mongodb',
    'dsn' => 'mongodb+srv://mongo:27017/dbname',
]

Adding a database name to the configuration works around the issue, but it is redundant with the information in the URL:

'mongo' => [
    'driver' => 'mongodb',
    'dsn' => 'mongodb+srv://mongo:27017/dbname',
    'database' => 'dbname',
]

Bug #1861's fix fixed this problem for mongodb:// style URLs but its parser missed mongodb+srv://.

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