I am trying to get stats on how many docs were created per period
[
{
$bucket: {
groupBy: "$createdAt",
boundaries: [
ISODate("2024-06-01"),
ISODate("2024-06-30"),
ISODate("2024-07-01"),
ISODate("2024-08-30")
],
default: null,
output: {
count: {
$sum: 1
},
arr: {
$push: {
createdAt: "$createdAt"
}
}
}
}
},
{
$match: {
_id: {
$ne: null // exclude the default
}
}
},
]
But I want to know in each period for example
ISODate("2024-06-01"),
ISODate("2024-06-30"),
between those dates (and for each period in boundaries) what are the minimum, maximum, and avg inserted docs per day…
any suggestion?