在整个文档,Google和此站点中都有一些示例。
一些参考:
- http://api.mongodb.org/python/current/examples/aggregation.html
- http://docs.mongodb.org/manual/reference/aggregation/group/
- http://docs.mongodb.org/manual/reference/aggregation/sum/
对于一些代码:
self.db.aggregate( # Lets find our records {"$match":{"Time":{"$gte":100,"$lte":1000}}}, # Now lets group on the name counting how many grouped documents we have {"$group":{"_id":"$name", "sum":{"$sum":1}}} )
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)