# .has()

### has(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**                                                |
| --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | Whether or not there is any entry matching the provided filter |

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

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

Users.has(u => u.name === '5antos'); // true
Users.has(u => u.id === 2); // false
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://simpldb.js.org/v2.11.0/documentation/collection/has.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
