Answers for "group by date field in mongo"

1

mongodb group by date

db.getCollection('supportIssuesChat').aggregate([
{
        $group : {
           _id :{ $dateToString: { format: "%Y-%m-%d", date: "$createdAt"} },
           list: { $push: "$$ROOT" },
           count: { $sum: 1 }
        }
}
])
Posted by: Guest on April-24-2021

Browse Popular Code Answers by Language