Skip to content

Commit 91ea8ca

Browse files
DOCS-16308 findAndModify and deleteOne partial shard key updates (#4798) (#4908)
* DOCS-16308 findAndModify and deleteOne partial shard key updates (#4798) * 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 * DOCS-16308-backport-v6.0 fix rebase issue
1 parent ae95c3b commit 91ea8ca

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
@@ -329,8 +329,11 @@ Upsert with Unique Index
329329
Sharded Collections
330330
~~~~~~~~~~~~~~~~~~~
331331

332-
To use :dbcommand:`findAndModify` on a sharded collection, the query
333-
filter must include an equality condition on the shard key.
332+
To use :dbcommand:`findAndModify` on a sharded collection:
333+
334+
- If you only target one shard, you can use a partial shard key in the ``query`` field or,
335+
336+
- You can provide an equality condition on a full shard key in the ``query`` field.
334337

335338
.. include:: /includes/extracts/missing-shard-key-equality-condition-findAndModify.rst
336339

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
@@ -262,8 +262,11 @@ Upsert with Unique Index
262262
Sharded Collections
263263
~~~~~~~~~~~~~~~~~~~
264264

265-
When using :dbcommand:`findAndModify` against a sharded collection, the
266-
``query`` **must** contain an equality condition on :term:`shard key`.
265+
To use :dbcommand:`findAndModify` on a sharded collection:
266+
267+
- If you only target one shard, you can use a partial shard key in the ``query`` field or,
268+
269+
- You can provide an equality condition on a full shard key in the ``query`` field.
267270

268271
.. include:: /includes/extracts/missing-shard-key-equality-condition-findAndModify.rst
269272

0 commit comments

Comments
 (0)