RedisSearch greater than datetime query does not work

59 Views Asked by At

I try to query item from json storage which datetime property have to be greater than DateTime.UtcNow, here is the example:

var datetime = DateTime.UtcNow;
var obj = json.Get(key, path: $"$.event[?(@.Expires_At>=\"{datetime}\")]");

But it can`t find it. Less than works and returns the data:

var obj2 = json.Get<T>(key, path: $"$.event[?(@.Starts_At<\"{datetime}\")]");

I`ve tried googling how redis handles comparing datetime fields, but there is no right example with greater than(also less than)

Im expecting to find the object that has Expires_At fields value greater than DateTime.UtcNow

Update: The data in the json storage:

  • Starts_At:"2023-06-24T18:54:07.682Z"
  • Expires_At:"2023-06-29T18:54:07.682Z"
0

There are 0 best solutions below