Skip to content Skip to sidebar Skip to footer

Gcloud Datastore: Can I Filter With In Or Contains Operator?

I am a new bee with the Datastore gCloud. And I want to filter in an entity called Score all the scores that have relation with a list of companies. My entity is formed as follows:

Solution 1:

The filters operators you seek are not supported by the datastore. The only supported ones are listed in Filters:

The comparison operator can be any of the following:

Operator                  Meaning
EQUAL                     Equal to
LESS_THAN                 Less than
LESS_THAN_OR_EQUAL        Less than or equal to
GREATER_THAN              Greater than
GREATER_THAN_OR_EQUAL     Greater than or equal to

Some of the client libraries may offer some equivalents, but with limitations. For example the standard environment GAE-specific ndb library (not usable in your context) offers such support. The example from The != and IN Operations can be useful as you can implement it in a similar manner in your code:

Similarly, the IN operation

property IN [value1, value2, ...]

which tests for membership in a list of possible values, is implemented as

(property == value1) OR (property == value2) OR ...

Post a Comment for "Gcloud Datastore: Can I Filter With In Or Contains Operator?"