From e819619186c7312faad94e1865accad2adff4bcf Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 17 Jul 2025 15:47:42 -0400 Subject: [PATCH 1/4] DOCSP-51035: parse_uri() options --- source/connect.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source/connect.txt b/source/connect.txt index cb4e7f2..2bdf092 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -144,8 +144,10 @@ function accepts the following arguments: - ``uri``: Your MongoDB connection URI. - ``db_name``: The name of the database you want to use. -- ``test``: Provides a dictionary of settings for test - databases. This argument is optional. To learn more, see +- ``options``: *(Optional)* A dictionary of options to apply to the connection. + These options take precedence over any duplicate options specified in the URI. +- ``test``: *(Optional)* Provides a dictionary of settings for test + databases. To learn more, see `the TEST setting <{+django-docs+}/ref/settings/#test>`__ in the {+framework+} documentation. @@ -160,8 +162,12 @@ example: import django_mongodb_backend - 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="") + MONGODB_URI = "mongodb+srv://my_user:my_password@cluster0.example.mongodb.net/" + DATABASES["default"] = django_mongodb_backend.parse_uri( + MONGODB_URI, + db_name="", + options={"retryWrites": "true", "w": "majority"} + ) Additional Information ---------------------- From ae6dc75f941c443ae6403b70a01265b8f344e92a Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 17 Jul 2025 15:49:11 -0400 Subject: [PATCH 2/4] fix --- source/connect.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/connect.txt b/source/connect.txt index 2bdf092..df23069 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -166,7 +166,7 @@ example: DATABASES["default"] = django_mongodb_backend.parse_uri( MONGODB_URI, db_name="", - options={"retryWrites": "true", "w": "majority"} + options={"retryWrites": True, "w": "majority"} ) Additional Information From a844378a66b925fc73fc69bc1c1d0e651da45dc4 Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 17 Jul 2025 15:55:31 -0400 Subject: [PATCH 3/4] spacing --- source/connect.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/connect.txt b/source/connect.txt index df23069..7da9001 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -145,7 +145,7 @@ function accepts the following arguments: - ``uri``: Your MongoDB connection URI. - ``db_name``: The name of the database you want to use. - ``options``: *(Optional)* A dictionary of options to apply to the connection. - These options take precedence over any duplicate options specified in the URI. + These options take precedence over any duplicate options specified in the URI. - ``test``: *(Optional)* Provides a dictionary of settings for test databases. To learn more, see `the TEST setting <{+django-docs+}/ref/settings/#test>`__ From 17dca5e7b30eba23d83b2da6dd24181fef306fa9 Mon Sep 17 00:00:00 2001 From: norareidy Date: Mon, 21 Jul 2025 10:13:40 -0400 Subject: [PATCH 4/4] MW feedback --- source/connect.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/connect.txt b/source/connect.txt index 7da9001..3ae7bfb 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -145,7 +145,7 @@ function accepts the following arguments: - ``uri``: Your MongoDB connection URI. - ``db_name``: The name of the database you want to use. - ``options``: *(Optional)* A dictionary of options to apply to the connection. - These options take precedence over any duplicate options specified in the URI. + These options take precedence over any duplicate options that you specify in the URI. - ``test``: *(Optional)* Provides a dictionary of settings for test databases. To learn more, see `the TEST setting <{+django-docs+}/ref/settings/#test>`__