How do I use ‘IN’ query in objectify? I have a ‘Paper’ entity and a different entity ‘Schedule’. In ‘Schedule’ I have key of paper. Now I get a few keys of ‘Paper’ using some criteria. Now I want to filter those with ‘scheduledDate’. I want to query ‘Schedule’ with something like this: get 'schedule' from 'Schedule' where 'paper key' in (List of paper keys) and 'scheduledDate' = 'some date'. How do I do this in objectify? Thanks
How do I use ‘IN’ query in objectify? I have a ‘Paper’ entity and
Share
Objectify is a thin wrapper around low-level Datastore API, so IN operator behaves the same as the low-level API:
This assumes that your
Scheduleclass has a fieldList<Key> paperthat contains list of keys pointing toPaperentities (you could also haveList<Key<Paper>> paperif you use objectify’s type-safeKeys).Note how
INperforms a series of queries under the hood and combines result. So in a sense it behaves as a series of “=” operators whose result is merged: