From df5377680b52aa54ab1747fa0e52235bd3961fd3 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Tue, 11 Mar 2025 08:34:16 -0500 Subject: [PATCH] DOCSP-48306 - Fix type hints (#212) (cherry picked from commit 9e673bc4ba75bdd0506a69c5361b413e77e77489) --- source/tools.txt | 2 ++ source/write/bulk-write.txt | 31 ------------------------------- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/source/tools.txt b/source/tools.txt index d3516d83..de6eaa4d 100644 --- a/source/tools.txt +++ b/source/tools.txt @@ -260,6 +260,8 @@ daemon in the global application group: and in the `Multiple Python Sub Interpreters `__ section of the mod_wsgi documentation. +.. _pymongo-tools-type-checkers: + Type Checkers ------------- diff --git a/source/write/bulk-write.txt b/source/write/bulk-write.txt index 7cc8f212..5ed216e1 100644 --- a/source/write/bulk-write.txt +++ b/source/write/bulk-write.txt @@ -366,37 +366,6 @@ The ``MongoClient.bulk_write()`` method returns a ``ClientBulkWriteResult`` obje * - ``upserted_count`` - | The number of documents upserted, if any. -Type Hints ----------- - -.. include:: /includes/type-hints/intro.rst - -When you use the ``bulk_write()`` method to perform an ``InsertOne`` or ``ReplaceOne`` -operation, -The following code example shows how to insert -- ``~pymongo.collection.Collection.bulk_write()`` - -For ``bulk_write()``, both the ``~pymongo.operations.InsertOne()`` and -``~pymongo.operations.ReplaceOne()`` operators are generic. - -The following code example shows that the results are the same as the preceding examples -when you call the ``bulk_write()`` method: - -.. code-block:: python - - from typing import TypedDict - from pymongo import MongoClient - from pymongo.operations import InsertOne - from pymongo.collection import Collection - client: MongoClient = MongoClient() - collection: Collection[Movie] = client.test.test - inserted = collection.bulk_write([InsertOne(Movie(name="Jurassic Park", year=1993))]) - result = collection.find_one({"name": "Jurassic Park"}) - assert result is not None - assert result["year"] == 1993 - -.. include:: /includes/type-hints/tip-more-info.rst - Troubleshooting ---------------