我是mongodb的新手,我有一个人的集合,其中一些人有我感兴趣的值。我想把这些值相加,得到有这些值的人的数量。
{ "_id" : 001, "tot" : 10, "duration", 100}
{ "_id" : 002, "tot" : 20, "duration", 200}
{ "_id" : 003, "tot" : 20, "duration", 300}
{ "_id" : 004}
{ "_id" : 005}
我想买
{ "num" : 3, "tot" : 50, "duration" : 600}
非常感谢
1条答案
按热度按时间ej83mcc01#
可以在mongoDB中使用聚合函数