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?
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.
If you create all of your "User" entities under a "Root" entity and add a "uuid" property to your "Trip" entity, you can look for the single "Trip" with the specified UUID.
Filter uuidFilter = new FilterPredicate("uuid", FilterOperator.EQUAL, uuid.toString()); Query q = new Query("Trip").setAncestor(root.getKey()).setFilter(uuidFilter);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With