@@ -77,7 +77,9 @@ method for added type safety:
7777 class Restaurant(TypedDict):
7878 name: str
7979
80- sample_restaurants.restaurants.insert_one(Movie(name="Mongo's Burgers")
80+ sample_restaurants.restaurants.insert_one(Restaurant(name="Mongo's Burgers")
81+
82+ .. include:: /includes/type-hints/tip-type-checkers.rst
8183
8284Insert Multiple Documents
8385-------------------------
@@ -121,6 +123,8 @@ instances of the ``Restaurant`` class. This adds type safety to the insert opera
121123
122124 sample_restaurants.restaurants.insert_many(document_list)
123125
126+ .. include:: /includes/type-hints/tip-type-checkers.rst
127+
124128Modify Insert Behavior
125129----------------------
126130
@@ -205,7 +209,7 @@ calling the ``insert_many()`` method instead.
205209TypedDict Missing _id Key
206210~~~~~~~~~~~~~~~~~~~~~~~~~
207211
208- As discussed above, if you don't specify the ``_id`` field, {+driver-short+} automatically
212+ If you don't specify the ``_id`` field, {+driver-short+} automatically
209213inserts it into the document.
210214You can retrieve the value of the ``_id`` field at runtime, but if you use MyPy or another
211215tool to perform static type-checking, it won't find the ``_id`` field in your class and
@@ -313,8 +317,10 @@ The following code example shows how to implement this solution:
313317
314318.. important:: NotRequired Requires Python 3.11+
315319
316- The ``NotRequired`` class is available only in Python 3.11 and later.
317- To use ``NotRequired`` in earlier versions of Python, install the ``typing_extensions``
320+ The `NotRequired <https://docs.python.org/3/library/typing.html#typing.NotRequired>`__
321+ class is available only in Python 3.11 and later.
322+ To use ``NotRequired`` in earlier versions of Python, install the
323+ `typing_extensions <https://pypi.org/project/typing-extensions/>`__
318324 package instead.
319325
320326Additional Information
0 commit comments