> 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.first.md).

# Collection.first()

#### Syntax

```javascript
collection.first(callback)
```

#### Parameters

| callback: Function | function (item) { } | *optional* |
| ------------------ | ------------------- | ---------- |

#### Callback Parameters

| item: Object | First item in the collection if any. Otherwise *undefined* |
| ------------ | ---------------------------------------------------------- |

#### Return Value

Promise

#### Remarks

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 be rejected, calling any Promise.catch() callback.
