3

I'm trying to use a compound index of 3 attributes to filter out a range of entries using the between() function.

For example:

db.version(1).stores ({
    apps: "id,age,shoeSize,height,[age+shoeSize+height]"
});

db.table
    .where('[age+shoeSize+height]')
    .between([15, 8, 60], [20, 10, 70]);

I would expect the above to output entries with ages between 15-20, AND shoeSizes between 8-10 AND heights between 60-70.

However, Dexie seems to be only filtering by age here (and sorting it by ascending age) without filtering out any shoeSizes or heights that do not fall in the range that I'm querying for. There are no console errors when I run the code. Am I misunderstanding how between and compound indexes work? Is there any way in Dexie that I can achieve this sort of functionality?

Edan Lewis
  • 31
  • 4

1 Answers1

0

From what I can tell, one workaround is to filter on the WhereClause by one attribute (age, for example), then further filter the resulting collection object by the remaining filters. I'm wondering if there is another way to do it though, using between() and compound indices.

Edan Lewis
  • 31
  • 4