Skip to content

Collection.eachUniqueKey()

David Fahlander edited this page May 8, 2014 · 3 revisions

Syntax

collection.eachUniqueKey(callback)

Parameters

callback: Function function (key, cursor) { }

Callback Parameters

key: Object Found key
cursor: IDBCursor The cursor of the object being iterated.

Return Value

Promise

Remarks

When iteration finish, returned Promise will resolve with undefined, calling any Promise.then() callback.

If operation fails, returned promise will reject, calling any Promise.catch() callback.

Sample

db.friends.orderBy('firstName').eachUniqueKey(function (firstName) {
    // This callback will be called once for each unique firstName in DB no matter
    // if having multiple friends with same name.
});
Clone this wiki locally