mongodb 杂记

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

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

posted @ 2017-11-06 15:10  longtengdama  阅读(95)  评论(0编辑  收藏  举报