I am trying to do something that I think is quite simple. Suppose I have a series of records in mongo that have a common key, and variable number of attributes. I want to select
use $addToSet to the group,it will work
$addToSet
db.data.aggregate( { $group : { _id : "$Name", x: { $addToSet: "$x" }, y: { $addToSet: "$y" }, z: { $addToSet: "$z" }, }} )