MongoDB学习笔记 - Aggregation (1)
MongoDB里面经常需要做一些统计任务,这里使用Aggregate 内嵌文档的例子,例如下面的文档,我们希望找到type 1的colors 的数量总和
inventory collection 如下:
{"_id" : 1, "item" : "ABC1","type",1, "description" : "product 1", colors: [ "blue","black",
原创
2017-02-18 14:41:15 ·
1188 阅读 ·
0 评论