From db0df7b6e362bf2e038208f58a94b7b73e617346 Mon Sep 17 00:00:00 2001 From: jason-price-mongodb <69260375+jason-price-mongodb@users.noreply.github.com> Date: Mon, 25 Oct 2021 10:55:34 -0700 Subject: [PATCH] DOCS-14854 findOneAndUpdate sharded (#6039) Co-authored-by: jason-price-mongodb --- source/core/sharded-cluster-requirements.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/core/sharded-cluster-requirements.txt b/source/core/sharded-cluster-requirements.txt index e0d5c9c281f..2db0a3c2f94 100644 --- a/source/core/sharded-cluster-requirements.txt +++ b/source/core/sharded-cluster-requirements.txt @@ -37,6 +37,16 @@ Single Document Modification Operations in Sharded Collections .. include:: /includes/fact-single-modification-in-sharded-collections.rst +To use :method:`~db.collection.findOneAndUpdate()` with a sharded +collection, your query filter must include an equality condition on the +:term:`shard key` to compare the key and value in either of these +formats: + +.. code-block:: javascript + + { key: value } + { key: { $eq: value } } + .. _sharding-requirements-unique-indexes: Unique Indexes in Sharded Collections