📜  mongodb 按日期分组 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:54.242000             🧑  作者: Mango

代码示例1
db.getCollection('supportIssuesChat').aggregate([
{
        $group : {
           _id :{ $dateToString: { format: "%Y-%m-%d", date: "$createdAt"} },
           list: { $push: "$$ROOT" },
           count: { $sum: 1 }
        }
}
])