Skip to content

Commit f49e6e8

Browse files
schmallisokay-kim
authored andcommitted
guides-review: addresses jesse's motor feedback (#71)
1 parent 41b4f1e commit f49e6e8

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

source/includes/driver-example-delete-57.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@
4747
:start-after: Start Example 57
4848
:end-before: End Example 57
4949
50+
For completeness, the following example shows how you might wrap
51+
the delete many operation with the asyncio event loop:
52+
53+
.. code-block:: python
54+
55+
async def do_delete_many():
56+
document = await db.inventory.delete_many({"status": "A"})
57+
pprint.pprint(document.raw_result)
58+
5059
Run the loop to execute both the ``delete_one`` and ``delete_many``
5160
operations:
5261

source/includes/driver-example-delete-58.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@
4747
:dedent: 8
4848
:start-after: Start Example 58
4949
:end-before: End Example 58
50+
51+
For completeness, the following example shows how you might wrap
52+
the delete one operation with the asyncio event loop:
53+
54+
.. code-block:: python
55+
56+
async def do_delete_one():
57+
document = await db.inventory.delete_one({"status": "D"})
58+
pprint.pprint(document.raw_result)
5059
5160
- id: java-sync
5261
content: |

source/includes/driver-example-update-52.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,26 @@ to ``paper``. The operation uses:
8989
embedded documents, the operation uses :ref:`dot notation
9090
<document-dot-notation>`.
9191
92-
- :``$currentDate`` to set the ``lastModified`` field to the
92+
- ``$currentDate`` to set the ``lastModified`` field to the
9393
current date.
9494
9595
.. literalinclude:: /driver-examples/test_examples_motor.py
9696
:language: python
9797
:dedent: 8
9898
:start-after: Start Example 52
9999
:end-before: End Example 52
100+
101+
For completeness, the following example shows how you might wrap
102+
the update one operation with the asyncio event loop:
103+
104+
.. code-block:: python
105+
106+
async def do_update_one():
107+
document = await db.inventory.update_one(
108+
{"item": "paper"},
109+
{"$set": {"size.uom": "cm", "status": "P"},
110+
"$currentDate": {"lastModified": True}})
111+
pprint.pprint(document.raw_result)
100112
101113
- id: java-sync
102114
content: |

source/includes/driver-example-update-53.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,19 @@
5959
:start-after: Start Example 53
6060
:end-before: End Example 53
6161
62-
Run the loop to execute both the ``update_one`` and ``update_many``
62+
For completeness, the following example shows how you might wrap
63+
the update many operation with the asyncio event loop:
64+
65+
.. code-block:: python
66+
67+
async def do_update_many():
68+
document = await db.inventory.update_many(
69+
{"qty": {"$lt": 50}},
70+
{"$set": {"size.uom": "in", "status": "P"},
71+
"$currentDate": {"lastModified": True}})
72+
pprint.pprint(document.raw_result)
73+
74+
Run the asyncio loop to execute both the ``update_one`` and ``update_many``
6375
operations:
6476
6577
.. code-block:: python

source/includes/drivers_close_connection.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
- id: motor
99
content: |
1010

11-
1211
- id: java-sync
1312
content: |
1413

0 commit comments

Comments
 (0)