Search code examples
google-cloud-datastoregoogle-cloud-platformgql

How to query NotEqual condition in GQL


I want to filter out some data. I tried different criterias How to query using GQL Not equal condition ?


Solution

  • This isn't possible with Cloud Datastore. See the list of operators here:

    https://cloud.google.com/datastore/docs/reference/gql_reference#operators_and_comparisons

    Comparators are either equivalence comparators: =, IN, CONTAINS, = NULL, HAS ANCESTOR, and HAS DESCENDANT, or inequality comparators: <, <=, >, and >=.

    This is also worth noting:

    There is no way to determine whether an entity lacks a value for a property (that is, whether the property has no value). If you use a condition of the form property = NULL, what will occur is a check whether a null value is explicitly stored for that property. Datastore queries that refer to a property will never return entities that don't have a value for that property.