-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: 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.
- duplicates
-
SERVER-13841 allow optional field specified in $addToSet operator to determine uniqueness
- Closed