Skip to content

Commit 573e83f

Browse files
DOCS-16308 findAndModify and deleteOne partial shard key updates (#4798) (#4909)
* DOCS-16308 partial shard key * DOCS-16308 partial shard key * DOCS-16308 update delete one * DOCS-16308 fix method label * DOCS-16308 updates to italicized letters
1 parent 28fd049 commit 573e83f

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
All |single-modification-operation-names| operations for a sharded
2-
collection that specify the |single-modification-operation-option|
3-
option must include the :term:`shard key` *or* the ``_id`` field in
4-
the query specification.
1+
To use |single-modification-operation-names| operations for a sharded
2+
collection that specify the |single-modification-operation-option| option:
53

6-
|single-modification-operation-names| operations specifying
7-
|single-modification-operation-option| in a sharded collection which do
8-
not contain either the :term:`shard key` or the ``_id`` field return an
9-
error.
4+
- If you only target one shard, you can use a partial shard key in the query specification or,
105

6+
- You can provide the :term:`shard key` or the ``_id`` field in the query
7+
specification.

source/reference/command/findAndModify.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,11 @@ Upsert with Unique Index
397397
Sharded Collections
398398
~~~~~~~~~~~~~~~~~~~
399399

400-
To use :dbcommand:`findAndModify` on a sharded collection, the query
401-
filter must include an equality condition on the shard key.
400+
To use :dbcommand:`findAndModify` on a sharded collection:
401+
402+
- If you only target one shard, you can use a partial shard key in the ``query`` field or,
403+
404+
- You can provide an equality condition on a full shard key in the ``query`` field.
402405

403406
.. include:: /includes/extracts/missing-shard-key-equality-condition-findAndModify.rst
404407

source/reference/method/db.collection.deleteOne.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,12 @@ if used on a :term:`time series collection`.
130130
Sharded Collections
131131
~~~~~~~~~~~~~~~~~~~
132132

133-
:method:`db.collection.deleteOne()` operations on a sharded collection
134-
must include the :term:`shard key` *or* the ``_id`` field in the query
135-
specification. :method:`db.collection.deleteOne()` operations in a
136-
sharded collection which do not contain either the :term:`shard key` or
137-
the ``_id`` field return an error.
133+
To use :method:`db.collection.deleteOne` on a sharded collection:
134+
135+
- If you only target one shard, you can use a partial shard key in the query specification or,
136+
137+
- You can provide the :term:`shard key` or the ``_id`` field in the query
138+
specification.
138139

139140
Transactions
140141
~~~~~~~~~~~~

source/reference/method/db.collection.findAndModify.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,11 @@ Upsert with Unique Index
268268
Sharded Collections
269269
~~~~~~~~~~~~~~~~~~~
270270

271-
When using :dbcommand:`findAndModify` against a sharded collection, the
272-
``query`` **must** contain an equality condition on :term:`shard key`.
271+
To use :dbcommand:`findAndModify` on a sharded collection:
272+
273+
- If you only target one shard, you can use a partial shard key in the ``query`` field or,
274+
275+
- You can provide an equality condition on a full shard key in the ``query`` field.
273276

274277
.. include:: /includes/extracts/missing-shard-key-equality-condition-findAndModify.rst
275278

0 commit comments

Comments
 (0)