Search code examples
google-app-enginegoogle-cloud-datastore

Google App Engine Datastore: How to get entity by ID/Name if parent key is unknown?


There are two kinds of entity: User and Trip. User is parent to Trip and Trip is child to User.

For privacy consideration I am POSTing only Trip ID/Name. Because it is looks like a Trip Key contains encoded User ID/Name.

How to get entity by ID/Name if parent key is unknown?


Solution

  • You can't. Parent key is part of the entity key and you need a full key to get an entity.

    Also query with key filter won't find entities with parents unless you specify the ancestor key.