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