jjzjj

Mongodb 月周?

我坚持要实现weekofMonth而不是WeekofYear。有人可以指导我如何正确执行此操作吗?db.activity.aggregate([{$group:{_id:{week:{$week:"$createdAt"},month:{$month:"$createdAt"},year:{$year:"$createdAt"}},count:{$sum:1}}},{$match:{"_id.year":2016,"_id.month":5}}])输出/*1*/{"_id":{"week":19,"month":5,"year":2016},"count":133.0}/*2*/{"_