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

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor - P4
    • Resolution: Done
    • 4.0.0, 4.2.0, 4.4.0, 5.0.0, 5.1.0
    • 4.0.0, 4.2.0, 4.4.0, 5.0.0, 5.1.0
    • manual, Server
    • 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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              1 year, 31 weeks ago