慕先生3293204
db.bus_alarm_stat.aggregate([{ $project: { "busNo": "$busNo","groupId" :"$groupId","date":"$date","DANGEROUS_DRIVE":"$data.DANGEROUS_DRIVE","FATIGUE_DRIVE" : "$data.FATIGUE_DRIVE", "OUT_AREA":"$data.OUT_AREA"}},{$match:{"date":{"$gte": "2017-07-23","$lte": "2017-07-25"}}},{"$group":{_id:"$busNo",DANGEROUS_DRIVE:{"$sum":"$DANGEROUS_DRIVE"},FATIGUE_DRIVE:{"$sum":"$FATIGUE_DRIVE"},OUT_AREA:{"$sum":"$OUT_AREA"}, }}]);自己把它解决啦