我的收藏是这样的:
"_id": ObjectId(""),
"score": 500,
"year": 2015,
"batch": 1
"location": "Shenzhen"
我要做的是:
-
group
with keybatch
year
location
-
sort
withscore
asc
- 获取各组
top 10
id, year, batch, location, score
使用聚合框架:
db.collection.aggregate(
{$group:{...}},
{$sort:{...}})
{$limit: 10}
);