Skip to content

Commit 46e533a

Browse files
DOCSP-48306 - Fix type hints (#212) (#214)
(cherry picked from commit 9e673bc) Co-authored-by: Mike Woofter <[email protected]>
1 parent a8a010f commit 46e533a

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
@@ -553,37 +553,6 @@ The ``MongoClient.bulk_write()`` method returns a ``ClientBulkWriteResult`` obje
553553
* - ``upserted_count``
554554
- | The number of documents upserted, if any.
555555

556-
Type Hints
557-
----------
558-
559-
.. include:: /includes/type-hints/intro.rst
560-
561-
When you use the ``bulk_write()`` method to perform an ``InsertOne`` or ``ReplaceOne``
562-
operation,
563-
The following code example shows how to insert
564-
- ``~pymongo.collection.Collection.bulk_write()``
565-
566-
For ``bulk_write()``, both the ``~pymongo.operations.InsertOne()`` and
567-
``~pymongo.operations.ReplaceOne()`` operators are generic.
568-
569-
The following code example shows that the results are the same as the preceding examples
570-
when you call the ``bulk_write()`` method:
571-
572-
.. code-block:: python
573-
574-
from typing import TypedDict
575-
from pymongo import MongoClient
576-
from pymongo.operations import InsertOne
577-
from pymongo.collection import Collection
578-
client: MongoClient = MongoClient()
579-
collection: Collection[Movie] = client.test.test
580-
inserted = collection.bulk_write([InsertOne(Movie(name="Jurassic Park", year=1993))])
581-
result = collection.find_one({"name": "Jurassic Park"})
582-
assert result is not None
583-
assert result["year"] == 1993
584-
585-
.. include:: /includes/type-hints/tip-more-info.rst
586-
587556
Troubleshooting
588557
---------------
589558

0 commit comments

Comments
 (0)