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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Done
    • Affects Version/s: 4.0.0, 4.2.0, 4.4.0, 5.0.0, 5.1.0
    • Fix Version/s: 4.0.0, 4.2.0, 4.4.0, 5.0.0, 5.1.0
    • Component/s: manual, Server
    • Labels:
      None
    • Last comment by Customer:
      true
    • Story Points:
      3
    • Sprint:
      ServerDocs2021: Oct12 - Oct19, ServerDocs2021: Oct19 - Oct26

      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

            Assignee:
            jason.price Jason Price
            Reporter:
            lungang.fang Lungang Fang
            Participants:
            Last commenter:
            Jason Price Jason Price
            External Reviewer:
            Lungang Fang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since reply:
              6 weeks, 1 day ago
              Date of 1st Reply: