-
-
Notifications
You must be signed in to change notification settings - Fork 646
Table.get()
David Fahlander edited this page Nov 25, 2016
·
15 revisions
table.get(primaryKey, callback);
table.get({keyPath1: value1, keyPath2: value2, ...}, callback);
primaryKey | Primary key of object to get | |
callback: Function | function (item) { } |
optional |
keyPath | String identifying keyPath to filter on | |
value | Value to match |
item: Object | Found item if any, otherwise undefined. |
Fetches object of given primaryKey or criteras ({keyPath1: value1, keyPath2: value2}) and returns the first matching result.
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.
let firstFriend = await db.friends.get(1);
let austinPowers = await db.friends.get({firstName: "Austin", lastName: "Powers"});
Dexie.js - minimalistic and bullet proof indexedDB library