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

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

    XMLWordPrintable

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
    • 3
    • ServerDocs2021: Oct12 - Oct19, ServerDocs2021: Oct19 - Oct26
    • true

    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
            Jason Price Jason Price
            Lungang Fang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              30 weeks, 4 days ago