I would like to display all records of a collection without repetition.
As if the query would look like this: "SELECT machine_name FROM collection GROUP BY machine_name.
I tried the options below and all went wrong:
1) {"$group":{"_id":{"machine_name":"$machine_name"},"value": {"machine_name":"$machine_name"}}}
2) {"$group":{"_id":{"machine_name":"$machine_name"}}}
3) {"$group":{"machine_name":"$machine_name"}}
[{
"$group" : {
"_id" : {
"MachineName" : "$machine_name"
}
}
},{
"$project" : {
"machine_name" : "$_id.MachineName"
}
}
]