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

Explicitly refer to "Single Field Matches" for positional "$ (update)" operator

    XMLWordPrintable

Details

    • Task
    • Status: Open
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • manual
    • None

    Description

      Description

      As of DOCS-3276, https://docs.mongodb.com/manual/reference/operator/update/positional/ provides instructions for matching multiple fields within an array for a positional update, using elemMatch.

      However, given the caveats with matching multiple fields (SERVER-14662), I think "the positional $ operator acts as a placeholder for the first element that matches the query document" language is leading to confusion.

      Would it be possible to reference something like "Update Embedded Documents Using a Single Field Match" in the Definition or Behavior section, as a prompt to direct readers to the "Update Embedded Documents Using Multiple Field Matches" section at the end of the page?

      By way of example, this is explicit in the "$ (projection)" documentation at https://docs.mongodb.com/manual/reference/operator/projection/positional/#array-field-limitations, with the following language: "The query document should only contain a single condition on the array field being projected. Multiple conditions may override each other internally and lead to undefined behavior."

      Thank you in advance!

      Scope of changes

      • Update and backport as needed

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              eric.sedor@mongodb.com Eric Sedor
              Ravind Kumar Ravind Kumar (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                3 years, 3 weeks, 6 days ago