Skip to content

Commit 8969322

Browse files
committed
DOCSP-48306 - Fix type hints (#212)
(cherry picked from commit 9e673bc)
1 parent 77b792c commit 8969322

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

369-
Type Hints
370-
----------
371-
372-
.. include:: /includes/type-hints/intro.rst
373-
374-
When you use the ``bulk_write()`` method to perform an ``InsertOne`` or ``ReplaceOne``
375-
operation,
376-
The following code example shows how to insert
377-
- ``~pymongo.collection.Collection.bulk_write()``
378-
379-
For ``bulk_write()``, both the ``~pymongo.operations.InsertOne()`` and
380-
``~pymongo.operations.ReplaceOne()`` operators are generic.
381-
382-
The following code example shows that the results are the same as the preceding examples
383-
when you call the ``bulk_write()`` method:
384-
385-
.. code-block:: python
386-
387-
from typing import TypedDict
388-
from pymongo import MongoClient
389-
from pymongo.operations import InsertOne
390-
from pymongo.collection import Collection
391-
client: MongoClient = MongoClient()
392-
collection: Collection[Movie] = client.test.test
393-
inserted = collection.bulk_write([InsertOne(Movie(name="Jurassic Park", year=1993))])
394-
result = collection.find_one({"name": "Jurassic Park"})
395-
assert result is not None
396-
assert result["year"] == 1993
397-
398-
.. include:: /includes/type-hints/tip-more-info.rst
399-
400369
Troubleshooting
401370
---------------
402371

0 commit comments

Comments
 (0)