$addToSet accumulator do in MongoDB aggregation?$addToSet adds unique values to an array during aggregation. It prevents duplicates, so each value appears only once.
$addToSet different from $push in MongoDB?$push adds all values to an array, including duplicates. $addToSet adds only unique values, skipping duplicates.
$addToSet usage in an aggregation pipeline.{ $group: { _id: "$category", uniqueItems: { $addToSet: "$item" } } }This groups documents by category and collects unique items in each group.
$addToSet be used to accumulate unique objects in an array?Yes, $addToSet can accumulate unique objects. Uniqueness is based on the whole object content, not just a field.
$addToSet on a field that contains arrays?$addToSet treats the entire array as one value. It adds the array only if it is unique compared to others.
$addToSet in MongoDB aggregation?$addToSet collects unique values into an array during aggregation.
$push adds all values including duplicates.
$addToSet collects unique values during grouping.
$addToSet do if the same object appears multiple times?$addToSet adds only one copy of identical objects.
$addToSet be used to accumulate unique arrays inside an array?$addToSet treats each array as a single value and adds it if unique.
$addToSet helps in creating arrays without duplicates in MongoDB aggregation.$addToSet and $push accumulators.