Javascript IndexedDb: searching a range of value using multiple keys -


is possible search indexeddb object store "bound" keyrange on multiple keys. following data:

  let simplea = {     id: 'a',     bottomx: 2.5,     bottomy: 5.5,     topx: 3.5,     topy: 6.5   };    let simpleb = {     id: 'b',     bottomx: 4.2,     bottomy: 4.2,     topx: 4.8,     topy: 4.8   };    let simplec = {     id: 'c',     bottomx: 8.5,     bottomy: 6.5,     topx: 9.5,     topy: 7.5   }; 

i have tried create index on multiple keys:

simplestore.createindex('bottomx bottomy topx topy', ['bottomx', 'bottomy', 'topx', 'topy']); 

and key range this:

let keyrange = idbkeyrange.bound(       [0,5,0,0],       [10,6,10,10] ); 

and creating cursor:

let mycursor = index.opencursor(keyrange); 

i hoping give me result of simplea , simpleb not simplec, because bottomy property not in range. however, tested code, realized first key of index tests bound keyrange.

is there way achieve range search on multiple keys?

for infos, got inspiration of multiple index post: javascript: searching indexeddb using multiple indexes

you have manually combine 4 individual key range queries.

indexeddb query support varying last key. example, following query work.

let keyrange = idbkeyrange.bound(       [0,5,10,0],       [0,5,10,10] ); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -