I'm trying to write a query that in SQL would look something like:
select * from WorkOrder wo
where wo.userId = 1
and wo.isSynced = 0
and wo.status in ('COMPLETE', 'REJECTED', 'SUSPENDED_NO_ACCESS', 'SUSPENDED_OTHER');
I've added an index on userId, isSynced, and status.
If I build a query like the following it works as long as I only filter on 2 different status values. As soon as I add 3 or more it doesn't return any results. Am I doing something wrong or do I need to approach this in a totally different way?
//this works
var keyRange = ydn.db.KeyRange.bound([userId, 0, Status.Complete],
[userId, 0, Status.REJECTED]);
//this doesn't work
var keyRange = ydn.db.KeyRange.bound([userId, 0, Status.Complete],
[userId, 0, Status.Suspended_AccessUnavailable],
[userId, 0, Status.REJECTED]);
var iterator = new ydn.db.IndexValueIterator(Store.WorkOrder, 'userId, isSynced, status', keyRange);
return db.values(iterator)