我的收藏是这样的:
"_id": ObjectId(""),
"score": 500,
"year": 2015,
"batch": 1
"location": "Shenzhen"
我正在做的是这样的:
group
带钥匙 batch
year
location
sort
与 score
asc
top 10
id, year, batch, location, score
使用
aggregation
框架:
db.collection.aggregate(
{ $group: { ... } },
{ $sort: {...} },
{ $limit: 10 }
);