Closed FS1360472174 closed 7 years ago
1.db.collections.aggregate( [ {$match:{}}, $group:{} ] )
先做匹配,再做聚合 mongo-aggregation-pipeline
{ _id : "jane", joined : ISODate("2011-03-02"), likes : ["golf", "racquetball"] }
db.users.aggregate( [ { $project : { name:{$toUpper:"$_id"} , _id:0 } }, { $sort : { name : 1 } } ]
$project 可以重命名字段
issues
aggregation 与mapreduce 区别
mapreduce 需要额外的去support