【发布时间】:2020-09-28 10:10:59
【问题描述】:
db.billingDomain.aggregate([
{
$group: {
_id: {
day: { $dayOfMonth: "$createdAt" },
month: { $month: "$createdAt" },
year: { $year: "$createdAt" }
},
count: {
$sum: 1
},
date: {
$first: "$createdAt"
}
}
},
{
$project: {
date: {
$dateToString: {
format: "%Y-%m-%d",
date: "$date"
}
},
count: 1,
_id: 0
}
},
{
$match: {
"date": {
$gte: "2020-06-05"
}
}
}
])
如何在 Spring Java 中使用 mongo Template、Aggregation 构建此查询?进行此查询时面临挑战
【问题讨论】:
标签: mongodb spring-boot aggregation-framework spring-mongodb mongotemplate