Search code examples
google-app-engineparent

AppEngine query for None parent


I'm trying to find all object which have no parent (i.e. which were created with parent=None). Using M.all().filter("parent = ", None).fetch(100) doesn't bring any results, even though some objects certainly do have no parent.

What am I doing wrong?


Solution

  • There's no way to query specifically for root entities. You need to either use external information (eg, no entity of type Foo has parents), or add a property that indicates if an entity is a root entity or not.