@@ -164,7 +164,7 @@ the one in the sample document. Select the :guilabel:`Synchronous` or
164
164
from datetime import datetime
165
165
166
166
collection = database["sample_collection"]
167
- find_result = await ( collection.find_one())["date"]
167
+ find_result = ( await collection.find_one())["date"]
168
168
print(f"datetime: {find_result}")
169
169
print(f"datetime.tzinfo: {find_result.tzinfo}")
170
170
@@ -230,7 +230,7 @@ to see the corresponding code:
230
230
231
231
options = CodecOptions(tz_aware = True)
232
232
collection = database.get_collection("sample_collection", options)
233
- find_result = await ( collection.find_one())["date"]
233
+ find_result = ( await collection.find_one())["date"]
234
234
235
235
print(f"datetime: {find_result}")
236
236
print(f"datetime.tzinfo: {find_result.tzinfo}")
@@ -311,7 +311,7 @@ or :guilabel:`Asynchronous` tab to see the corresponding code:
311
311
options = CodecOptions(tz_aware = True, tzinfo = pacific)
312
312
collection = database.get_collection("sample_collection", options)
313
313
314
- find_result = await ( collection.find_one())["date"]
314
+ find_result = ( await collection.find_one())["date"]
315
315
print(f"datetime: {find_result}")
316
316
print(f"datetime.tzinfo: {find_result.tzinfo}")
317
317
@@ -395,7 +395,7 @@ corresponding code:
395
395
396
396
print(f"datetime before storage: {local_datetime}")
397
397
await collection.insert_one({"date": local_datetime})
398
- find_result = await ( collection.find_one())["date"]
398
+ find_result = ( await collection.find_one())["date"]
399
399
print(f"datetime after storage: {find_result}")
400
400
401
401
.. output::
@@ -684,7 +684,7 @@ filter out document values outside of the range supported by
684
684
685
685
from datetime import datetime
686
686
coll = client.test.dates
687
- cur = await coll.find({'dt': {'$gte': datetime.min, '$lte': datetime.max}})
687
+ cur = coll.find({'dt': {'$gte': datetime.min, '$lte': datetime.max}})
688
688
689
689
If you don't need the value of ``datetime``, you can filter out just that field. Select the
690
690
:guilabel:`Synchronous` or :guilabel:`Asynchronous` tab to see the corresponding code:
@@ -703,7 +703,7 @@ If you don't need the value of ``datetime``, you can filter out just that field.
703
703
704
704
.. code-block:: python
705
705
706
- cur = await coll.find({}, projection={'dt': False})
706
+ cur = coll.find({}, projection={'dt': False})
707
707
708
708
API Documentation
709
709
-----------------
0 commit comments