Skip to content

Commit ca264a9

Browse files
small edits
1 parent 5e2d5a5 commit ca264a9

File tree

1 file changed

+47
-47
lines changed

1 file changed

+47
-47
lines changed

source/pymongo-async-migration.txt

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ all methods that perform network operations are coroutines and must be awaited.
3333
To migrate from {+driver-short+} to {+driver-async+}, you must update your code
3434
to replace all uses of ``MongoClient`` with ``AsyncMongoClient`` and add the
3535
``await`` keyword to all asynchronous method calls. If an asynchronous method is
36-
called within a function, you must mark the function as ``async``.
36+
called within a function, you must also mark the function as ``async``.
3737

3838
Asynchronous Methods
3939
~~~~~~~~~~~~~~~~~~~~
@@ -52,35 +52,35 @@ Client Methods
5252

5353
* - ``AsyncMongoClient()``
5454
- .. code-block:: python
55-
55+
5656
from pymongo import AsyncMongoClient
5757

5858
client = AsyncMongoClient(...)
5959

6060
* - ``watch()``
6161
- .. code-block:: python
62-
62+
6363
async with await client.watch(...) as stream:
6464
...
6565

6666
* - ``server_info()``
6767
- .. code-block:: python
68-
68+
6969
info = await client.server_info(...)
7070

7171
* - ``list_databases()``
7272
- .. code-block:: python
73-
73+
7474
databases = await client.list_databases()
7575

7676
* - ``list_database_names()``
7777
- .. code-block:: python
78-
78+
7979
database_names = await client.list_database_names()
8080

8181
* - ``drop_database()``
8282
- .. code-block:: python
83-
83+
8484
await client.drop_database(...)
8585

8686
Database Methods
@@ -95,13 +95,13 @@ Database Methods
9595

9696
* - ``watch()``
9797
- .. code-block:: python
98-
98+
9999
async with await db.watch(...) as stream:
100-
...
100+
...
101101

102102
* - ``create_collection()``
103103
- .. code-block:: python
104-
104+
105105
await db.create_collection(...)
106106

107107
* - ``aggregate()``
@@ -112,7 +112,7 @@ Database Methods
112112

113113
* - ``command()``
114114
- .. code-block:: python
115-
115+
116116
result = await db.command(...)
117117

118118
* - ``cursor_command()``
@@ -122,27 +122,27 @@ Database Methods
122122

123123
* - ``list_collections()``
124124
- .. code-block:: python
125-
125+
126126
collections = await db.list_collections()
127127

128128
* - ``list_collection_names()``
129129
- .. code-block:: python
130-
130+
131131
collection_names = await db.list_collection_names()
132132

133133
* - ``drop_collection()``
134134
- .. code-block:: python
135-
135+
136136
await db.drop_collection(...)
137-
137+
138138
* - ``validate_collection()``
139139
- .. code-block:: python
140-
140+
141141
result = await db.validate_collection(...)
142142

143143
* - ``dereference()``
144144
- .. code-block:: python
145-
145+
146146
result = await db.dereference(...)
147147

148148
Collection Methods
@@ -157,48 +157,48 @@ Collection Methods
157157

158158
* - ``watch()``
159159
- .. code-block:: python
160-
160+
161161
async with await collection.watch(...) as stream:
162-
...
162+
...
163163

164164
* - ``insert_one()``
165165
- .. code-block:: python
166-
166+
167167
await collection.insert_one(...)
168168

169169
* - ``insert_many()``
170170
- .. code-block:: python
171-
171+
172172
await collection.insert_many(...)
173-
173+
174174
* - ``replace_one()``
175175
- .. code-block:: python
176-
176+
177177
await collection.replace_one(...)
178178

179179
* - ``update_one()``
180180
- .. code-block:: python
181-
181+
182182
await collection.update_one(...)
183183

184184
* - ``update_many()``
185185
- .. code-block:: python
186-
186+
187187
await collection.update_many(...)
188188

189189
* - ``drop()``
190190
- .. code-block:: python
191-
191+
192192
await collection.drop()
193193

194194
* - ``delete_one()``
195195
- .. code-block:: python
196-
196+
197197
await collection.delete_one(...)
198198

199199
* - ``delete_many()``
200200
- .. code-block:: python
201-
201+
202202
await collection.delete_many(...)
203203

204204
* - ``find_one()``
@@ -208,12 +208,12 @@ Collection Methods
208208

209209
* - ``estimated_document_count()``
210210
- .. code-block:: python
211-
211+
212212
count = await collection.estimated_document_count()
213213

214214
* - ``count_documents()``
215215
- .. code-block:: python
216-
216+
217217
count = await collection.count_documents(...)
218218

219219
* - ``create_index()``
@@ -228,89 +228,89 @@ Collection Methods
228228

229229
* - ``drop_index()``
230230
- .. code-block:: python
231-
231+
232232
await collection.drop_index(...)
233233

234234
* - ``drop_indexes()``
235235
- .. code-block:: python
236-
236+
237237
await collection.drop_indexes()
238238

239239
* - ``list_indexes()``
240240
- .. code-block:: python
241-
241+
242242
indexes = await collection.list_indexes()
243243

244244
* - ``index_information()``
245245
- .. code-block:: python
246-
246+
247247
info = await collection.index_information()
248248

249249
* - ``list_search_indexes()``
250250
- .. code-block:: python
251-
251+
252252
indexes = await collection.list_search_indexes()
253253

254254
* - ``create_search_index()``
255255
- .. code-block:: python
256-
256+
257257
await collection.create_search_index(...)
258258

259259
* - ``create_search_indexes()``
260260
- .. code-block:: python
261-
261+
262262
await collection.create_search_indexes(...)
263263

264264
* - ``drop_search_index()``
265265
- .. code-block:: python
266-
266+
267267
await collection.drop_search_index(...)
268268

269269
* - ``update_search_index()``
270270
- .. code-block:: python
271-
271+
272272
await collection.update_search_index(...)
273273

274274
* - ``options()``
275275
- .. code-block:: python
276-
276+
277277
options = await collection.options()
278278

279279
* - ``aggregate()``
280280
- .. code-block:: python
281-
281+
282282
async for doc in await collection.aggregate(...):
283283
...
284284

285285
* - ``aggregate_raw_batches()``
286286
- .. code-block:: python
287-
287+
288288
async for batch in await collection.aggregate_raw_batches(...):
289289
...
290290

291291
* - ``rename()``
292292
- .. code-block:: python
293-
293+
294294
await collection.rename(...)
295295

296296
* - ``distinct()``
297297
- .. code-block:: python
298-
298+
299299
distinct_values = await collection.distinct(...)
300300

301301
* - ``find_one_and_delete()``
302302
- .. code-block:: python
303-
303+
304304
result = await collection.find_one_and_delete(...)
305305

306306
* - ``find_one_and_replace()``
307307
- .. code-block:: python
308-
308+
309309
result = await collection.find_one_and_replace(...)
310310

311311
* - ``find_one_and_update()``
312312
- .. code-block:: python
313-
313+
314314
result = await collection.find_one_and_update(...)
315315

316316
Migrate From Motor

0 commit comments

Comments
 (0)