# .fetch()

### fetch(filter)

| **Parameter** | **Description**                                                                                                                                                                                                                                              |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| filter        | <p><a href="https://developer.mozilla.org/en-US/docs/Glossary/Callback_function">Callback</a></p><p>Function to test each element of the array. Return a value that coerces to <code>true</code> to keep the element, or to <code>false</code> otherwise</p> |

| **Returns**                                                       | **Description**                     |
| ----------------------------------------------------------------- | ----------------------------------- |
| [Data](https://simpldb.gitbook.io/docs/types-and-interfaces/data) | First entry that matches the filter |

```javascript
// Note: Users is a collection.

Users.create({ id: 1, name: '5antos' }); // { id: 1, name: '5antos' }

Users.fetch(u => u.id === 1); // { id: 1, name: '5antos' }
Users.fetch(u => u.name === 'Unnamed user'); // null
```
