files/en-us/web/api/idbobjectstore/getallkeys/index.md
{{ APIRef("IndexedDB") }}
The getAllKeys() method of the {{domxref("IDBObjectStore")}}
interface returns an {{domxref("IDBRequest")}} object retrieves record keys for all
objects in the object store matching the specified parameter or all objects in the
store if no parameters are given.
If a value is successfully found, then a structured clone of it is created and set as the result of the request object.
This method produces the same result for:
To tell these situations apart, you need to call the {{domxref("IDBObjectStore.openCursor","openCursor()")}} method with the same key. That method provides a cursor if the record exists, and no cursor if it does not.
getAllKeys()
getAllKeys(query)
getAllKeys(query, count)
getAllKeys(options)
The getAllKeys() method can take separate parameters or a single options object containing the parameters as properties.
The parameters can include:
query {{optional_inline}}
count {{optional_inline}}
0 or greater than 2^32 - 1 a
{{jsxref("TypeError")}} exception will be thrown.If an object parameter is specified, its properties can include:
query {{optional_inline}}
query definition.count {{optional_inline}}
count definition.direction {{optional_inline}}
next
nextunique
next, because duplicate keys are not allowed in IDBObjectStores.prev
prevunique
prev, because duplicate keys are not allowed in IDBObjectStores.An {{domxref("IDBRequest")}} object on which subsequent events related to this operation are fired.
If the operation is successful, the value of the request's {{domxref("IDBRequest.result", "result")}} property is an {{jsxref("Array")}} of the keys for all records matching the given query, up to the value of count, if count was supplied.
This method may raise a {{domxref("DOMException")}} of one of the following types:
TransactionInactiveError {{domxref("DOMException")}}
DataError {{domxref("DOMException")}}
InvalidStateError {{domxref("DOMException")}}
count parameter is not between 0 and 2^32 - 1, inclusive.{{Specifications}}
{{Compat}}