0

I have a javascript indexeddb, each primary index is an two-long incrementing array, from [0,0] to [x,y]:

[0,0]
[0,1]
[0,2]
...
[1,0]
[1,1]
...
[x,y]

My current get request involves the following statement:

var transaction = db.transaction("myData", "readonly");
var c = transaction.objectStore("myData");
var a = c.getAll(IDBKeyRange.bound([0,0],[5,5]));

However, this gets all data where the first value is between 0 and 5, and does not take into account the second value, sending a return like the following:

[0,0]
[0,1]
[0,2]
...
[0,y]
[1,0]
...
[5,y]

Is there any way to get it to become more precise and take into account the y range? Using a cursor on all of the values is not acceptable.

2

1 Answer 1

0

A key-value store is less (much less?) efficient than a simply array for your data.

If you need to "save" the data between invocations of the web page, then perhaps toss that array into a JSON structure. That could be a single item in "indexeddb".

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.