我收集了如下“评论”:
{
comment_id:10001
aspects:[
{
name:'aspectA',
positive:2
negative:3
neutral:1
},
{
name:'aspectB',
positive:1
negative:5
neutral:3
}
},
{
comment_id:10002
aspects:
{
name:'aspectA',
positive:2
negative:1
neutral:2
},
{
name:'aspectB',
positive:3
negative:4
neutral:1
}
}
]
注释中的文档数大于100K。我必须找到所有方面的正、负和中性计数,即所有文档的aspects
字段(如上所述的DICT列表)中每个方面的正、负和中性之和。我发现mapreduce可以用来完成这项任务,但我找不到足够的文档来构建查询
有没有一种方法可以通过一个查询找到它
要按
aspects.name
求和,可以使用以下聚合:与
pymongo
一起:相关问题 更多 >
编程相关推荐