Skip to content

Connect blindly overrides username/password when URI style connection is used. #909

@ryan-lane

Description

@ryan-lane
mongoengine.register_connection(
    'myalias',
    'mydb',
    host='mongodb://localhost:27017',
    username='myuser',
    password=='mypassword'
)

The above will connect to mydb with username None and password None. This is because though a username and password are set, if a uri is used mongoengine will blindly override them: https://github.com/MongoEngine/mongoengine/blob/master/mongoengine/connection.py#L57

Is there any reason not to do 'or username' and 'or password' similar to what's being done for database?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions