MongoDB Django Database Backend

Thank you for using Django MongoDB Backend!

Try including the database name in the URI:

DATABASES = {
    "default": django_mongodb_backend.parse_uri("mongodb+srv://chrisdevcode:<pass>@djangomongo.oybyx.mongodb.net/default?retryWrites=true&w=majority&appName=djangomongo"),
}

Or try configuring the NAME setting like this:

DATABASES = {
    "default": django_mongodb_backend.parse_uri("mongodb+srv://chrisdevcode:<pass>@djangomongo.oybyx.mongodb.net/?retryWrites=true&w=majority&appName=djangomongo"),
}

DATABASES["default"]["NAME"] = "default"

Also in the beta 1 release of Django MongoDB Backend, you’ll be able to do this:

DATABASES = {
    "default": django_mongodb_backend.parse_uri("mongodb+srv://chrisdevcode:<pass>@djangomongo.oybyx.mongodb.net/?retryWrites=true&w=majority&appName=djangomongo", db_name="default"),
}

See: INTPYTHON-509 Add db_name parameter to parse_uri() by timgraham · Pull Request #249 · mongodb/django-mongodb-backend · GitHub for more information.

2 Likes