mongodb 杂记

db.businessLog.aggregate([{$group:{_id:"$createDatetime",totalsum:{$sum:1}}}]),分组查询

db.businessLog.aggregate([{$group:{_id:{year:{$year:'$createDatetime'},month:{$month:'$createDatetime'}},totalsum:{$sum:1}}}]) 多条件分组查询,按年和月进行分组

原文地址:https://www.cnblogs.com/longsanshi/p/7793270.html