-
-
Notifications
You must be signed in to change notification settings - Fork 668
Collection.keys()
David Fahlander edited this page May 13, 2014
·
12 revisions
collection.keys(callback)
callback: Function | function (keysArray) { } | optional |
keysArray: Array | Array of keys |
Given callback will recieve an array containing all keys of the index being indexed in the collection. Can only be used on indexes and not on primary keys.
If callback is omitted and operation succeeds, returned Promise will resolve with the result of the operation, calling any Promise.then() callback.
If callback is specified and operation succeeds, given callback will be called and the returned Promise will resolve with the return value of given callback.
If operation fails, returned promise will reject, calling any Promise.catch() callback.
// List all the first name of all my friends:
db.friends.orderBy('firstName').keys(function (firstNames) {
alert ("My friends are: " + firstNames.join(','));
});
// List all shoeSizes that my friends have (duplicates removed):
db.friends.orderBy('shoeSize').uniqueKeys(function (shoeSizes) {
alert ("My friends have the following shoe sizes: " + shoeSizes.join(','));
});
Dexie.js - minimalistic and bullet proof indexedDB library