I am using the low level datastore interface in java. I have an entity that stores a collection of Keys. I would like to query the datastore to get all of the entities in the collection. However, I'd also like to sort them on a created date property. So, I'd like to do something like this:
Query query = new Query(EndeavorUpdate.ENDEAVOR_UPDATE_ENTITY_TYPE);
//getEndeavorUpdateIds() returns a List < Key >
query.addFilter("__key__", Query.FilterOperator.EQUAL, getEndeavorUpdateIds());
query.addSort(EndeavorUpdate.CREATED_DATE_PROPERTY);
PreparedQuery pq = ds.prepare(query);
However, I get an exception saying that "a collection of values is not allowed". It does work if I use IN instead of EQUAL but that seems tremendously inefficient.
Is there a way to do this query efficiently or should I get all the entities from the datastore and do the sorting myself?