> For the complete documentation index, see [llms.txt](https://dexiejs.typogram.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dexiejs.typogram.co/collection/collection.eachprimarykey.md).

# Collection.eachPrimaryKey()

*Since 1.4.0*

#### Syntax

```javascript
collection.eachPrimaryKey(callback)
```

#### Parameters

#### Callback Parameters

#### Return Value

Promise

#### Remarks

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

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

#### Sample

```javascript
db.friends.orderBy('firstName').eachPrimaryKey(function (primaryKey) {
    // This callback will be called in the firstName order and provide
    // the primary key of the object it refers to.
});
```
