Skip to content

Commit 49b6d69

Browse files
committed
fixes
1 parent 445573a commit 49b6d69

File tree

2 files changed

+35
-23
lines changed

2 files changed

+35
-23
lines changed

snooty.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
2525
driver-short = "PyMongo"
2626
driver-long = "PyMongo, the MongoDB synchronous Python driver,"
2727
driver-async = "PyMongo Async"
28+
django-odm = "MongoDB Backend for Django"
2829
language = "Python"
2930
mdb-server = "MongoDB Server"
3031
mongo-community = "MongoDB Community Edition"

source/configure-connection.txt

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,44 @@ Manually Configure Database Settings
4747
To manually configure your connection to MongoDB, update
4848
the ``DATABASES`` setting in your project's ``settings.py``
4949
file. The ``DATABASES`` setting has a ``default`` key,
50-
which you must specify to set MongoDB as the default database
50+
which you must configure to set MongoDB as the default database
5151
connection.
5252

53-
To specify the ``default`` key, include the following
54-
information:
53+
To configure the ``default`` key, include the following
54+
fields:
5555

56-
- ``ENGINE``: The backend driver to use for the connection.
57-
Set this field to ``"django_mongodb_backend"``.
56+
.. list-table::
57+
:header-rows: 1
58+
:widths: 20 80
5859

59-
- ``HOST``: Your connection URI. For localhost connections,
60-
this field is optional. For SRV connections, you must include
61-
a scheme prefix (``mongodb+srv://``).
60+
* - Field
61+
- Description
6262

63-
If connecting to a replica set or sharded cluster with multiple hosts, specify
64-
each host separated by a comma.
63+
* - **ENGINE**
64+
- The backend driver to use for the connection. Set this field to ``"django_mongodb_backend"``.
6565

66-
- ``NAME``: The database you want to use.
66+
* - **HOST**
67+
- | Your connection URI. For localhost connections, this field is optional.
68+
| For SRV connections, you must include a scheme prefix (``mongodb+srv://``).
69+
|
70+
| If connecting to a replica set or sharded cluster with multiple hosts, specify
71+
| each host separated by a comma.
6772

68-
- ``USER``: The username for authenticating to the database.
73+
* - **NAME**
74+
- The database you want to use.
6975

70-
- ``PASSWORD``: The password for your database user.
76+
* - **USER**
77+
- The username for authenticating to the database.
7178

72-
- ``PORT``: The port number on which the database server is listening.
73-
For MongoDB Atlas connections, this field is optional.
79+
* - **PASSWORD**
80+
- The password for your database user.
7481

75-
- ``OPTIONS``: A dictionary of additional connection options for the database.
76-
This field is optional.
82+
* - **PORT**
83+
- | The port number on which the database server is listening.
84+
| For MongoDB Atlas connections, this field is optional.
85+
86+
* - **OPTIONS**
87+
- A dictionary of additional connection options for the database. This field is optional.
7788

7889
.. _django-manual-config-example:
7990

@@ -83,8 +94,8 @@ Example
8394
This example specifies the ``DATABASES`` setting to connect
8495
to a MongoDB deployment with the following configuration:
8596

86-
- Connects to the ``sample_db`` database
87-
- Provides authentication information for a user
97+
- Connects to the ``my_database`` database
98+
- Provides authentication information for a database user
8899
whose username is ``my_user`` and password is ``my_password``
89100
- Uses the default MongoDB port (``27017``)
90101
- Sets the ``retryWrites`` connection option to ``true``,
@@ -125,15 +136,15 @@ Automatically Configure Database Settings
125136

126137
To automatically construct the ``DATABASES`` setting that configures
127138
your MongoDB connection, you can use the ``parse_uri()`` method. This
128-
method accepts the following parameters:
139+
method accepts the following arguments:
129140

130141
- ``uri``: Your MongoDB connection URI.
131142
- ``conn_max_age``: Configures persistent database connections.
132-
This parameter is optional. To learn more, see
143+
This argument is optional. To learn more, see
133144
`Persistent connections <https://docs.djangoproject.com/en/stable/ref/databases/#persistent-database-connections>`__
134145
in the Django documentation.
135146
- ``test``: Provides a dictionary of settings for test
136-
databases. This parameter is optional. To learn more, see
147+
databases. This argument is optional. To learn more, see
137148
`the TEST setting <https://docs.djangoproject.com/en/stable/ref/settings/#test>`__
138149
in the Django documentation.
139150

@@ -149,7 +160,7 @@ example:
149160

150161
import django_mongodb_backend
151162

152-
MONGODB_URI = "mongodb+srv://my_user:[email protected]/myDatabase?retryWrites=true&w=majority"
163+
MONGODB_URI = "mongodb+srv://my_user:[email protected]/my_database?retryWrites=true&w=majority"
153164
DATABASES["default"] = django_mongodb_backend.parse_uri(MONGODB_URI)
154165

155166
Additional Information

0 commit comments

Comments
 (0)