This is an exercise to practices all stages we talked: $project,$match,$group,$sort, $skip,$limit
[{$match: {
grades: {$elemMatch: {grade: {$lte : "B"}}}
}}, {$group: {
_id: {district: "$district", cuisine: "$cuisine"},
sumOfRestaurants: {
$sum: 1
}
}}, {$project: {
_id:0,
district: "$_id.district",
cuisine: "$_id.cuisine",
sum: "$sumOfRestaurants"
}}, {$sort: {
sum: -1
}}, {$skip: 100}, {$limit: 5}]
Негізгі бет MongoDB - Aggregation Pipeline Stages Exercise: $project,$match,$group,$sort, $skip,$limit
No video
Пікірлер: 15