where date is a native js Date object. So would be it greaterThan or lessThan - that part of query doesn’t affect anything like it absent. But because I use aggregation for my request as a solution I apply match in pipeline:
But what can I do in simple query without aggregation?
I read something about intricacy with ISOdate and mongo but it did not clear anything. Tryed instead Date object substitute string (iso timestamp) and number (ms) - does not matter.
Thank for the answer. I replaced greaterThan to lessThan with no effect. If you say that it should work fine - my code had some simple/stupid mistake/mistyping.
I console.log date object (today) of course. Code look like this:
const now = new Date();
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const statQuery = await query()
.equalTo('merchant', merchant); // this condition working
.greaterThan('createdAt', today); // this condition does not effect
const result = await statQuery.aggregate(pipeline)
Please take it easy, I understood for the future that date comparing work in simple query (and I workaround it already for that case via comparing inside aggregation), so this problem not so actual.
But I have more interesting question about group inside facet (will write it soon in new topic).
Thank you, that’s the point. So with aggregation we must use for comparing only something inside aggregate, like match stage and comparing operators in my first message.