addToSet with specific fields

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • 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
            Reporter:
            Linar Savion
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: