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
![](https://secure.gravatar.com/avatar/92398bd381da10d729f5c2a50d2baf01?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)