Cannot filter charts using date field

I have a collection with fields date, counter and values like this:
counter : 19134
date : 2022-08-09T06:15:42.646+00:00

When I create a chart with counter on X axis and date on Y Axis both as unwind array the date field is recognized correctly as date - I can bin it as Date of month, and on the graph I can see values 09-Aug-2022

But when I switch to Filter and add show only Period: Previous 1 week it doesn’t work. It shows all values from the history.

Any hint is welcome…

Hi @psmith - Are you able to share a screenshot of the chart? I can’t think of a reason why this wouldn’t work, but a screenshot may reveal some clues.


take a look at these pictures. First one shows what is on axis, second the filter.


Thanks, this helps. The reason this is not working as expected is because your dates are stored in an array. The filter is being applied before the array is unwound so it is filtering for documents where any element of the array meets that criteria, and then when the array is unwound you are seeing some values that do not match the filter.

The solution is to unwind the array in the query bar rather than using the Array Reductions option. You can do this with the following query:

[{$unwind: "$auctions"}]

This will ensure the array is unwound before the filter is applied, so it should filter out all the values you expect.


1 Like

That worked.
Thank you!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.