发布于 2015-09-14 15:00:30 | 157 次阅读 | 评论: 0 | 来源: 网络整理

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 “聚合参考.”

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务