mongodb aggregation remove duplicates in array code example
Example: MongoDB - Unwind array using aggregation and remove duplicates
## MongoDB - Unwind array using aggregation and remove duplicates
db.users.aggregate([
{ $unwind: '$data' },
{ $group: { _id: '$_id', data: { $addToSet: '$data' } } }
]);