Dieser Meteor Servercode versucht Dokumente zu gruppieren und sortiert sie nach der Eigenschaft "period" aufsteigend, aber es tut es nicht, irgendeine Idee, wie es zu beheben? thxSo sortieren Sie Dokumente in Meteorhacken: Gesamtausgabe
let invoicePopulation = UsageCol.aggregate([
{
$match: {
action: {$in: ['a', 'b', 'c']},
userId: doc.userId
}
},
{
$group: {
_id: {period: "$period"},
count: {$sum: 1}
}
},
{
"$sort" : {
"period" : 1
}
}
]);
//output
[{"_id":{"period":"42017"},"count":14},{"_id":{"period":"22017"},"count":1},{"_id":{"period":"32017"},"count":271}]
//needs to be
[{"_id":{"period":"22017"},"count":1},{"_id":{"period":"32017"},"count":271},{"_id":{"period":"42017"},"count":14}]