0

There is requirement to query on multiple properties with '!=' on one property and '<=' on another property.

But seeing the Datastore docs , it is not possible. How can we make it possible as i dont want to create multiple indexes.

1 Answer 1

0

You simply cannot. You'll have a couple of choices here to work around that:

1- filter on one inequality, then in your code, filter for <=. You will get a bit too many results, but it will work.

2- Create a boolean property referring to your second condition. Add a boolean "smaller_than_x". Whenever you create the entity, the field you need filtered on <=, check if it is smaller than x. If it is, make the boolean true. Then you can filter on the boolean with an equality (this assumes that you always have the same value for x. if your value is dynamic, method 1 will be your best bet)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.