Hi @Ruben -
Three things:
- To use dates in your queries, you need to wrap the strings in
ISODate
- Dates need to be in Y-M-D format
- I’m guessing you probably want to also include data from the last day of April. In this case you should bring the end date forward by one day.
Putting these together, the query you likely want is:
{createdAt:{$gte:ISODate("2021-01-01"),$lt:ISODate("2020-05-01"}}
HTH
Tom