$dateTrunc aggregation operator doesn't return expected value

Hi @Liam_Tat_Tze_Tey

The time periods start at a reference date, which is determind by unit. If unit is:

  • A string other than week, $dateTrunc uses a reference date of 2000-01-01T00:00:00.00Z. For example, if binSize is 10 and unit is year, example time periods are: …

Accordingly the 7 day bins for the match selection are 2024-11-30 and 2024-12-07. 2024-12-07T00:00:00.00Z is the start of the next bin.

Would other units such as week or month be more suitable in this case ?
binSize: 7 and unit: 'day' : Mongo playground
unit:'month' and implicit binSize:1: Mongo playground
unit:'week' and implicit binSize:1: Mongo playground