File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -144,8 +144,10 @@ function accepts the following arguments:
144144
145145- ``uri``: Your MongoDB connection URI.
146146- ``db_name``: The name of the database you want to use.
147- - ``test``: Provides a dictionary of settings for test
148- databases. This argument is optional. To learn more, see
147+ - ``options``: *(Optional)* A dictionary of options to apply to the connection.
148+ These options take precedence over any duplicate options that you specify in the URI.
149+ - ``test``: *(Optional)* Provides a dictionary of settings for test
150+ databases. To learn more, see
149151 `the TEST setting <{+django-docs+}/ref/settings/#test>`__
150152 in the {+framework+} documentation.
151153
@@ -160,8 +162,12 @@ example:
160162
161163 import django_mongodb_backend
162164
163- MONGODB_URI = "mongodb+srv://my_user:my_password@cluster0.example.mongodb.net/?retryWrites=true&w=majority"
164- DATABASES["default"] = django_mongodb_backend.parse_uri(MONGODB_URI, db_name="<database name>")
165+ MONGODB_URI = "mongodb+srv://my_user:my_password@cluster0.example.mongodb.net/"
166+ DATABASES["default"] = django_mongodb_backend.parse_uri(
167+ MONGODB_URI,
168+ db_name="<database name>",
169+ options={"retryWrites": True, "w": "majority"}
170+ )
165171
166172Additional Information
167173----------------------
You can’t perform that action at this time.
0 commit comments