...
Code Block |
---|
|
db.getCollection('events').aggregate([
{
$match: { "time": { "$gte": 1577836800 }, "acknowledged": { "$eq": 0 } }
},
{
$group: {
_id: { event: "$event", priority: "$priority" },
priorities: { $push: "$priority" },
total: { $sum: 1 }
}
},
{
$group: {
_id: "$_id.event",
priorities: { $push: { priority: "$_id.priority", count: "$total" } },
}
}
]) |
Priority sorted for all events which are not acknowledged
Code Block |
---|
|
db.getCollection('events').aggregate([
{
$match: { "time": { "$gte": 1577836800 }, "acknowledged": { "$eq": 0 } }
},
{
$group: {
_id: "$priority",
total: { $sum: 1 }
}
},
{$sort: {"_id": 1}}
]) |
Image Added