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

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

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None

      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            eric.sedor@mongodb.com Eric Sedor
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              1 year, 24 weeks, 4 days ago