db.collection.aggregate()

db.collection.aggregate(pipeline)

2.1.0 新版功能.

Always call the db.collection.aggregate() method on a collection object.

Arguments:
  • pipeline – Specifies a sequence of data aggregation processes. See the aggregation reference for documentation of these operators.

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" }
  } }
);

也可以参考

“aggregate,” “聚合框架,” and “聚合参考.”

MongoDB Manual (Index)

关于

生态系统

格式

资源