Skip to content

Commit 3045f0d

Browse files
Rea feedback
1 parent edfff73 commit 3045f0d

File tree

2 files changed

+38
-37
lines changed

2 files changed

+38
-37
lines changed

source/index.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ in the :ref:`pymongo-upgrade` section.
124124
Migrate to the {+driver-async+} Driver
125125
------------------------------------
126126

127-
Learn how to migrate from {+driver-short+} or Motor to the {+driver-async+} driver in the
128-
:ref:`pymongo-async-migration` section.
127+
In September 2024, MongoDB released the {+driver-async+} driver to unify {+driver-short+}
128+
and `Motor <https://www.mongodb.com/docs/drivers/motor/>`__, the asynchronous
129+
MongoDB driver for Python. Learn how to migrate from {+driver-short+} or Motor
130+
to the {+driver-async+} driver in the :ref:`pymongo-async-migration` section.
129131

130132
Previous Versions
131133
-----------------

source/pymongo-async-migration.txt

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ Migrate to the {+driver-async+} Driver
2020
Overview
2121
--------
2222

23-
In September 2024, MongoDB released the {+driver-async+} driver to unify {+driver-short+}
24-
and `Motor <https://www.mongodb.com/docs/drivers/motor/>`__, the asynchronous
25-
MongoDB driver for Python. In this guide, you can identify the changes you must
26-
make to migrate an application from {+driver-short+} or Motor to the
27-
{+driver-async+} driver.
23+
The {+driver-async+} driver is a unification of {+driver-short+} and the `Motor
24+
library <https://www.mongodb.com/docs/drivers/motor/>`__. In this guide, you can
25+
identify the changes you must make to migrate an application from
26+
{+driver-short+} or Motor to the {+driver-async+} driver.
2827

2928
Migrate From {+driver-short+}
3029
--------------------
@@ -35,7 +34,7 @@ To migrate from {+driver-short+} to {+driver-async+}, you must update your code
3534
in the following ways:
3635

3736
- Replace all uses of ``MongoClient`` with ``AsyncMongoClient``.
38-
- Add the ``await`` keyword to all asynchronous method calls .
37+
- Add the ``await`` keyword to all asynchronous method calls.
3938
- If an asynchronous method is called within a function, mark the function as ``async``.
4039

4140
The following sections describe how to implement the asynchronous API.
@@ -62,28 +61,28 @@ Client Methods
6261

6362
from pymongo import AsyncMongoClient
6463

65-
client = AsyncMongoClient(...)
64+
AsyncMongoClient(...)
6665

6766
* - ``watch()``
6867
- .. code-block:: python
6968

7069
async with await client.watch(...) as stream:
71-
...
70+
...
7271

7372
* - ``server_info()``
7473
- .. code-block:: python
7574

76-
info = await client.server_info(...)
75+
await client.server_info(...)
7776

7877
* - ``list_databases()``
7978
- .. code-block:: python
8079

81-
databases = await client.list_databases()
80+
await client.list_databases()
8281

8382
* - ``list_database_names()``
8483
- .. code-block:: python
8584

86-
database_names = await client.list_database_names()
85+
await client.list_database_names()
8786

8887
* - ``drop_database()``
8988
- .. code-block:: python
@@ -104,7 +103,7 @@ Database Methods
104103
- .. code-block:: python
105104

106105
async with await db.watch(...) as stream:
107-
...
106+
...
108107

109108
* - ``create_collection()``
110109
- .. code-block:: python
@@ -115,27 +114,27 @@ Database Methods
115114
- .. code-block:: python
116115

117116
async with await client.admin.aggregate(...) as cursor:
118-
...
117+
...
119118

120119
* - ``command()``
121120
- .. code-block:: python
122121

123-
result = await db.command(...)
122+
await db.command(...)
124123

125124
* - ``cursor_command()``
126125
- .. code-block:: python
127126

128-
curr = await db.cursor_command(...)
127+
await db.cursor_command(...)
129128

130129
* - ``list_collections()``
131130
- .. code-block:: python
132131

133-
collections = await db.list_collections()
132+
await db.list_collections()
134133

135134
* - ``list_collection_names()``
136135
- .. code-block:: python
137136

138-
collection_names = await db.list_collection_names()
137+
await db.list_collection_names()
139138

140139
* - ``drop_collection()``
141140
- .. code-block:: python
@@ -145,12 +144,12 @@ Database Methods
145144
* - ``validate_collection()``
146145
- .. code-block:: python
147146

148-
result = await db.validate_collection(...)
147+
await db.validate_collection(...)
149148

150149
* - ``dereference()``
151150
- .. code-block:: python
152151

153-
result = await db.dereference(...)
152+
await db.dereference(...)
154153

155154
Collection Methods
156155
``````````````````
@@ -166,7 +165,7 @@ Collection Methods
166165
- .. code-block:: python
167166

168167
async with await collection.watch(...) as stream:
169-
...
168+
...
170169

171170
* - ``insert_one()``
172171
- .. code-block:: python
@@ -211,17 +210,17 @@ Collection Methods
211210
* - ``find_one()``
212211
- .. code-block:: python
213212

214-
result = await collection.find_one(...)
213+
await collection.find_one(...)
215214

216215
* - ``estimated_document_count()``
217216
- .. code-block:: python
218217

219-
count = await collection.estimated_document_count()
218+
await collection.estimated_document_count()
220219

221220
* - ``count_documents()``
222221
- .. code-block:: python
223222

224-
count = await collection.count_documents(...)
223+
await collection.count_documents(...)
225224

226225
* - ``create_index()``
227226
- .. code-block:: python
@@ -246,17 +245,17 @@ Collection Methods
246245
* - ``list_indexes()``
247246
- .. code-block:: python
248247

249-
indexes = await collection.list_indexes()
248+
await collection.list_indexes()
250249

251250
* - ``index_information()``
252251
- .. code-block:: python
253252

254-
info = await collection.index_information()
253+
await collection.index_information()
255254

256255
* - ``list_search_indexes()``
257256
- .. code-block:: python
258257

259-
indexes = await collection.list_search_indexes()
258+
await collection.list_search_indexes()
260259

261260
* - ``create_search_index()``
262261
- .. code-block:: python
@@ -281,19 +280,19 @@ Collection Methods
281280
* - ``options()``
282281
- .. code-block:: python
283282

284-
options = await collection.options()
283+
await collection.options()
285284

286285
* - ``aggregate()``
287286
- .. code-block:: python
288287

289288
async for doc in await collection.aggregate(...):
290-
...
289+
...
291290

292291
* - ``aggregate_raw_batches()``
293292
- .. code-block:: python
294293

295294
async for batch in await collection.aggregate_raw_batches(...):
296-
...
295+
...
297296

298297
* - ``rename()``
299298
- .. code-block:: python
@@ -303,22 +302,22 @@ Collection Methods
303302
* - ``distinct()``
304303
- .. code-block:: python
305304

306-
distinct_values = await collection.distinct(...)
305+
await collection.distinct(...)
307306

308307
* - ``find_one_and_delete()``
309308
- .. code-block:: python
310309

311-
result = await collection.find_one_and_delete(...)
310+
await collection.find_one_and_delete(...)
312311

313312
* - ``find_one_and_replace()``
314313
- .. code-block:: python
315314

316-
result = await collection.find_one_and_replace(...)
315+
await collection.find_one_and_replace(...)
317316

318317
* - ``find_one_and_update()``
319318
- .. code-block:: python
320319

321-
result = await collection.find_one_and_update(...)
320+
await collection.find_one_and_update(...)
322321

323322
Migrate From Motor
324323
------------------
@@ -340,8 +339,8 @@ read and write operations in Motor compared to {+driver-async+}:
340339
from pymongo import AsyncMongoClient
341340

342341

343-
The following section shows the method signature changes that you must make when
344-
migrating from Motor to the {+driver-async+} driver.
342+
The following section shows the method signature changes that you must implement
343+
in your application when migrating from Motor to the {+driver-async+} driver.
345344

346345
Method Signature Changes
347346
~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)