Skip to content

Commit 7bd4097

Browse files
committed
DOCSP-48306 - Fix type hints (#212)
(cherry picked from commit 9e673bc)
1 parent 225082a commit 7bd4097

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

source/tools.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ daemon in the global application group:
260260
and in the `Multiple Python Sub Interpreters <https://modwsgi.readthedocs.io/en/master/user-guides/application-issues.html#multiple-python-sub-interpreters>`__
261261
section of the mod_wsgi documentation.
262262

263+
.. _pymongo-tools-type-checkers:
264+
263265
Type Checkers
264266
-------------
265267

source/write/bulk-write.txt

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -318,37 +318,6 @@ The ``bulk_write()`` method returns a ``BulkWriteResult`` object. The
318318
- | A map of the operation's index to the ``_id`` of the upserted documents, if
319319
applicable.
320320

321-
Type Hints
322-
----------
323-
324-
.. include:: /includes/type-hints/intro.rst
325-
326-
When you use the ``bulk_write()`` method to perform an ``InsertOne`` or ``ReplaceOne``
327-
operation,
328-
The following code example shows how to insert
329-
- ``~pymongo.collection.Collection.bulk_write()``
330-
331-
For ``bulk_write()``, both the ``~pymongo.operations.InsertOne()`` and
332-
``~pymongo.operations.ReplaceOne()`` operators are generic.
333-
334-
The following code example shows that the results are the same as the preceding examples
335-
when you call the ``bulk_write()`` method:
336-
337-
.. code-block:: python
338-
339-
from typing import TypedDict
340-
from pymongo import MongoClient
341-
from pymongo.operations import InsertOne
342-
from pymongo.collection import Collection
343-
client: MongoClient = MongoClient()
344-
collection: Collection[Movie] = client.test.test
345-
inserted = collection.bulk_write([InsertOne(Movie(name="Jurassic Park", year=1993))])
346-
result = collection.find_one({"name": "Jurassic Park"})
347-
assert result is not None
348-
assert result["year"] == 1993
349-
350-
.. include:: /includes/type-hints/tip-more-info.rst
351-
352321
Troubleshooting
353322
---------------
354323

0 commit comments

Comments
 (0)