Finding missing date using aggregation

Hello, I’m working on aggregation and bar charts using next.js.
I’m recording my data daily. When the first day of the month has started, I would like to make all dates from 1st to 30th(/31st). Since I’m using bar charts, if there’s only one data, it only shows one bar chart.
And sometimes there’s no data for the day, and I want to fill the gap setting the value of powerIn as 0.
I found $fill and $densify but those won’t work. And I already looked into another question similar as mine that someone recommending making a mock collection or doing it on server side, I found this tricker. Could anyone give me solution on this?


You may be able to use $range in an aggregation to generate the missing days.

See the following thread for examples specific to using dates.