Details
-
Improvement
-
Resolution: Done
-
Minor - P4
-
4.0.0, 4.2.0, 4.4.0, 5.0.0, 5.1.0
-
None
Description
Hi,
In the Single Document Modification Operations in Sharded Collections section of MongoDB documentation, it talks about updateOne() and deleteOne() but does not mention the findOneAndUpdate(). However, this command (i.e. findOneAndUpdate()) also subjects to similar limitation. Although the details can be found in Sharded Collections section (quoted below), I'd suggest also adding a reminder in the Single Document Modification Operations in Sharded Collections section to avoid confusion.
To use db.collection.findOneAndUpdate() on a sharded collection, the query filter must include an equality condition on the shard key.
Regards,
Lungang