Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding some way to retrieve secondary keys when using IDBIndex.getAllKeys #71

Closed
malibuzios opened this issue Mar 19, 2016 · 2 comments

Comments

@malibuzios
Copy link

When using IDBIndex.openKeyCursor to retrieve all (index) keys satisfying some range, I can easily get the secondary key (the value of the property indexed for that particular record) in addition to the primary one, for example:

...
let results = [];

let cursorRequest = objectStore.index("myIndex").openKeyCursor(range);

cursorRequest.onsuccess = (event) => {
    let cursor = event.target.result;

    if (cursor) {
        results.push({ primaryKey: cursor.primaryKey, key: cursor.key });
        cursor.continue();
    }
    else {
        resolve(results);
    }
}
...

It seems that IDBIndex.getAllKeys currently only returns the primary keys (tested on latest stable Firefox/Chrome versions). Is/will there be any way to retrieve the secondary keys as well? or falling back to using cursors is planned to remain the most efficient solution?

@tophf
Copy link

tophf commented Apr 20, 2019

In my tests IDBIndex.openKeyCursor on 4000 of relatively simple records seems to be practically unusable in Chrome - 150ms compared to 15ms of IDBIndex.getAllKeys.

@inexorabletash
Copy link
Member

#206 is a dupe of this, but has more context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants