You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- The username for authenticating to the database.
88
+
- The username for authenticating to the database, if your connection
89
+
requires authentication.
79
90
80
91
* - **PASSWORD**
81
-
- The password for your database user.
92
+
- The password for your database user, if your connection requires authentication.
82
93
83
94
* - **PORT**
84
-
- | The port number on which the database server is listening.
95
+
- | The port number on which the database server is listening. The default
96
+
port is ``27017``.
85
97
| For MongoDB Atlas connections, this key is optional.
86
98
87
99
* - **OPTIONS**
88
-
- A dictionary of additional connection options for the database. This key is optional.
100
+
- | A dictionary of additional connection options for the database. This key is optional.
101
+
| To see a full list of connection options that you can set in the ``OPTIONS`` key,
102
+
see the optional parameters for `MongoClient <https://pymongo.readthedocs.io/en/4.10.1/api/pymongo/mongo_client.html#pymongo.mongo_client.MongoClient>`__
103
+
in the PyMongo API documentation.
89
104
90
105
.. _django-manual-config-example:
91
106
92
107
Example
93
108
```````
94
109
95
-
This example specifies the ``DATABASES`` variable to connect
96
-
to a MongoDB deployment with the following configuration:
110
+
In this example, the ``DATABASES`` variable specifies the
111
+
following connection configuration:
97
112
98
-
- Connects to the ``my_database`` database
113
+
- Sets the database to ``my_database``
99
114
- Provides authentication information for a database user
100
115
whose username is ``my_user`` and password is ``my_password``
101
-
- Uses the default MongoDB port (``27017``)
116
+
- Specifies the default MongoDB port (``27017``)
102
117
- Sets the ``retryWrites`` connection option to ``true``,
103
118
which configures the driver to automatically retry certain
104
119
write operations if they fail
@@ -123,13 +138,6 @@ to a MongoDB deployment with the following configuration:
123
138
},
124
139
}
125
140
126
-
.. tip::
127
-
128
-
To see a full list of connection options that you
129
-
can set in the ``OPTIONS`` key, see the optional
130
-
parameters for `MongoClient <https://pymongo.readthedocs.io/en/4.10.1/api/pymongo/mongo_client.html#pymongo.mongo_client.MongoClient>`__
131
-
in the PyMongo API documentation.
132
-
133
141
.. _django-connection-configure-automatic:
134
142
135
143
Automatically Configure Database Settings
@@ -152,9 +160,8 @@ method accepts the following arguments:
152
160
Example
153
161
```````
154
162
155
-
The following example uses the ``parse_uri()`` method to connect
156
-
to a MongoDB deployment with the same configuration as
157
-
the previous :ref:`manual configuration <django-manual-config-example>`
163
+
The following example uses the ``parse_uri()`` method to specify
164
+
the same connection configuration as the previous :ref:`manual configuration <django-manual-config-example>`
0 commit comments