Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-32714

addToSet with specific fields

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Currently when updating an array with subdocuments according to a specific key, i.e. given array

      [{id: 1, val: 'a'}, {id: 2, val: 'a'}, {id: 3, val: 'b'}]

      , if we want to update ids 1 and 2 to new values, we would need to issue multiple update statements (which results in a blown oplog).

      Adding an optional argument to addToSet to consider only specific fields would allow updating multiple subdocuments in a single call by only specifying the unique field.

      This would both improve performance and reduce oplog size, and it seems like a simple addition.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: