[NOT READY] fix granularity

This commit is contained in:
Emily
2024-12-07 18:24:48 +01:00
parent ad8e9e1ead
commit 78f979d23a
3 changed files with 13 additions and 10 deletions

View File

@@ -69,19 +69,22 @@ export async function executeAdvancedTimelineAggregation<T = {}>(options: Advanc
...options.customGroup
}
},
{
$sort: { "_id.isoDate": 1 }
},
{
$densify: {
field: "_id.isoDate",
range: {
step: 1,
unit: granularity,
bounds: "full"
bounds: [
new Date(options.from),
new Date(options.to)
]
}
}
},
{
$sort: { "_id.isoDate": 1 }
},
{
$addFields: { count: { $ifNull: ["$count", 0] }, }
},