Add an option for $addToSet to use a specific field in the array for uniqueness
Currently, the $addToSet for upserting to an array checks for object equality (when the array elements are objects). We sometimes need to check for uniqueness based on a specific field of the object rather than the object as a whole, and the only way to do this is to force single-threaded operation and to use $pull and $push.
If there is a way to specify the field to check uniqueness for the $addToSet , we would be able to perform writes normally.
1
vote
Nitin
shared this idea