diff --git a/source/connect.txt b/source/connect.txt index 946e253..265e793 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -145,6 +145,7 @@ your MongoDB connection, you can use the ``parse_uri()`` function. This function accepts the following arguments: - ``uri``: Your MongoDB connection URI. +- ``db_name``: The name of the database you want to use. - ``conn_max_age``: Configures persistent database connections. This argument is optional. To learn more, see `Persistent connections <{+django-docs+}/ref/databases/#persistent-database-connections>`__ @@ -165,8 +166,8 @@ example: import django_mongodb_backend - MONGODB_URI = "mongodb+srv://my_user:my_password@cluster0.example.mongodb.net/my_database?retryWrites=true&w=majority" - DATABASES["default"] = django_mongodb_backend.parse_uri(MONGODB_URI) + MONGODB_URI = "mongodb+srv://my_user:my_password@cluster0.example.mongodb.net/?retryWrites=true&w=majority" + DATABASES["default"] = django_mongodb_backend.parse_uri(MONGODB_URI, db_name="") Additional Information ---------------------- diff --git a/source/get-started/connect-mongodb.txt b/source/get-started/connect-mongodb.txt index 84b23c1..d98c477 100644 --- a/source/get-started/connect-mongodb.txt +++ b/source/get-started/connect-mongodb.txt @@ -64,7 +64,7 @@ you can create a {+framework+} project that connects to MongoDB. .. code-block:: python DATABASES = { - "default": django_mongodb_backend.parse_uri(""), + "default": django_mongodb_backend.parse_uri("", db_name=""), } Replace the ```` placeholder with the connection string diff --git a/source/get-started/connection-string.txt b/source/get-started/connection-string.txt index fc6dee5..1fa7e04 100644 --- a/source/get-started/connection-string.txt +++ b/source/get-started/connection-string.txt @@ -54,18 +54,5 @@ when applicable, and connection options. Replace the ```` and ```` placeholders with your database user's username and password. - .. step:: Add a database to your connection string - - Specify a database connection in your connection string by adding - your database name after the hostname, as shown in the following example: - - .. code-block:: none - :copyable: false - - mongodb+srv://:@samplecluster.ojeyz.mongodb.net/?retryWrites=true&w=majority&appName=SampleCluster - - Replace the ```` placeholder with ``sample_mflix`` to - configure a connection to the ``sample_mflix`` Atlas sample database. - After completing these steps, you have a connection string that contains your database username, database password, and database name. \ No newline at end of file