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

addToSet with specific fields

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

      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.

            Assignee:
            asya.kamsky@mongodb.com Asya Kamsky
            Reporter:
            linar-jether Linar Savion
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: