Search code examples
javagoogle-app-enginegqlgqlquery

Select Objects with null values


How can I select only objects with null values in GQL. I have a object that for a new version of my software I include a LastUpdate fields, and I want to update only the oldest updated object, but when I made the query using " ORDER BY LastUpdate ASC", this query should always be used!, it always return only the objects with some value in LastUpdate.

How the best way I can include in a query the objects with null value?


Solution

  • If an entity in the datastore does not have the new attribute set, then it is impossible to query on it.

    The entities will not have a null value for the property, the property simply will not exist, therfore will not be included in any indexes that you would use to query your entities. The only way to find your entities that need updating is to map over ALL entities and find the ones with missing values.