发布于 2015-09-14 15:00:30 | 168 次阅读 | 评论: 0 | 来源: 网络整理
2.1.0 新版功能.
Always call the db.collection.aggregate() method on a collection object.
Arguments: |
|
---|
Consider the following example from the aggregation documentation.
db.article.aggregate(
{ $project : {
author : 1,
tags : 1,
} },
{ $unwind : "$tags" },
{ $group : {
_id : { tags : 1 },
authors : { $addToSet : "$author" }
} }
);