Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-14854

Mention "findOneAndUpdate" in "Single Document Modification Operations in Sharded Collections"

      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

            Assignee:
            jason.price@mongodb.com Jason Price
            Reporter:
            lungang.fang@mongodb.com Lungang Fang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              2 years, 26 weeks ago