我的文档是:
[
{ '_id': 1, number: 10, span: 5, rated:'Yes', sectionID: 3},
{ '_id': 2, number: 20, span: 6, rated:'Yes', sectionID: 3},
{ '_id': 3, number: 4, span: 5, rated:'No', sectionID: 5},
{ '_id': 4, number: 2, span: 0, rated:'Yes', sectionID: 6},
{ '_id': 22, number: 9, span: 6, rated:'No', sectionID: 3},
]
我想对sectionID 3的数字和跨度字段求和
所以结果将是:
number: 30, span: 11
我看过这个很棒的post,但是无法同时处理两个领域。