I've got a mock up indexedDB holds items like:
{
id:1002,
name:"Frank",
company: "dg",
age:30
}
And I've created the index ['name','age','company'] , just want to get the result I need like websql do.
getMultipleDataByRange function defined to get items, I set ['0',24,'ef']
as lowerBound
and ['z',24,'ef']
as upperBound
, I thought it should show me the result match the items who's 24 years old plus whose company is "ef". But the result shows that all the items meet the range I set. How can I set the range to get the correct result.
Code can also be checked by JSBIN link I generated:
It'll work if you change the order of your index so that the part that varies (name) is at the end. If you want to know why, see In IndexedDB, is there a way to make a sorted compound query? for an explanation of how compound indexes work in IndexedDB.