0

I try to find objects in google datastore via GQL and JSON API by date range. For example, this is my request:

SELECT * FROM table WHERE uuid = "test" AND start >= 100 AND end <= 150

But i get error:

{ errors: 
  [ { domain: 'global',
   reason: 'INVALID_ARGUMENT',
   message: 'can\'t have inequality filters on different properties: [start, end]' } ],
  code: 400,
  message: 'can\'t have inequality filters on different properties: [start, end]' }

Can i edit this request or use another way to get objects by date range?

MrPovod
  • 193
  • 6
  • possible duplicate of [Availability date range queries in app engine datastore?](http://stackoverflow.com/questions/23319489/availability-date-range-queries-in-app-engine-datastore) – Ed Davisson May 15 '14 at 18:02
  • No, i use nodejs and JSON API. – MrPovod May 15 '14 at 18:17
  • 2
    Cloud Datastore is backed by the same implementation and only supports inequality filters on a single property: https://developers.google.com/datastore/docs/concepts/queries#Datastore_Inequality_filters_are_limited_to_at_most_one_property – Ed Davisson May 15 '14 at 21:57

1 Answers1

0

You have two inequality statements in a single query which isn't supported by datastore/gql.

"start >= 100 AND end <= 150"

You could have "start >= 100 AND start <=150"

but not both start and end.

One solution is you need to set just one inequality in your GQL query and filter the results manually for the second inequality.

sradforth
  • 2,176
  • 2
  • 23
  • 37