Filter by DateTime

I am currently trying to work out how to compare datetimes with each other.
The straight forward way of adding some Index seems not applicable for me, since I want to compare the DateTime accurately by minutes and sometimes even seconds.

The question is, is this currently even possible efficiently?

To provide an example of my use-case, consider the following query:

{
    query(func:uid(...)) @filter(le(createdAt, "2018-03-16T00:30:00Z")) { 
        uid
    }
}

with the schema:

createdAt: dateTime . 

I hope the example is semantically correct, however, this does not work because createdAt is not indexed.
As far as I’ve seen, I can only index it by Year, Month, Day and Hour, but in this case, I want to retrieve only nodes, which are really smaller than the given dateTime 2018-03-16T00:30:00Z.

They can be indexed by hour, yet still be compared at more granular levels. Hour index helps us narrow down the search field, but then we use normal comparisons to check if the entries in the search field match the query parameters.

2 Likes

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