IDBIndex.getAllKeys()

The proposed getAllKeys() method of the IDBIndex interface would instantly retrieve the keys of all objects inside an object store, setting them as the result of the request object.

Note: This method is not currently included in the IndexedDB spec or available in any browsers, but is being considered for future addition.

Syntax

JavaScript
var myIndex = objectStore.index('index');
var getAllKeysRequest = myIndex.getAllKeys(query);

Returns

An IDBRequest object on which subsequent events related to this operation are fired.

Parameters

query Optional
A key or an IDBKeyRange identifying the keys to retrieve. If this value is null or missing, the browser will use an unbound key range.

Exceptions

This method may raise a DOMException of the following types:

Exception Description
TransactionInactiveError This IDBIndex's transaction is inactive.
InvalidStateError The IDBIndex has been deleted or removed.
 

Example

JavaScript
var myIndex = objectStore.index('index');
var getAllKeyRequest = myIndex.getAllKeys();
getAllKeysRequest.onsuccess = function() {
  console.log(getAllKeysRequest.result);
}

Specification

Specification Status Comment
Indexed Database API (Second Edition)
The definition of 'getAll()' in that specification.
Editor's Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 23webkit
24
10 moz
16.0 (16.0)
10, partial 15 7.1
count() 23 22.0 (22.0) 10, partial 15 7.1
getAll() and getAllKeys() 48.0 24.0 (24.0)
behind dom.indexedDB.experimental  pref
No support No support No support
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support 4.4

(Yes)

22.0 (22.0) 1.0.1 10 22 No support (Yes)
count() 4.4 ? 22.0 (22.0) 1.0.1 10 22 No support ?
getAll() and getAllKeys() No support 48.0 24.0 (24.0)
behind dom.indexedDB.experimental  pref
1.1 behind
dom.indexedDB.experimental  pref
No support No support No support 48.0

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/idbindex/getallkeys

API IndexedDB Method Reference