# Example: Filters

Use the following query option to apply filters:

### **filters**

**Type:** `Comfortable.Filter` \
collect or reduce documents by certain field values&#x20;

```javascript
const api = Comfortable.api('<repository-api-id>', '<api-key>');

var options = {
    filters: new Comfortable.Filter()
        .addAnd('title', 'like', '%Hello%')
        .addAnd('date', 'greaterThan', '2018-07-04')
        .addOr('topNews', 'equal', true)
        /** filter by document id **/
        .addAnd('id', 'equals', '123123123432425', 'meta')
        /** filter blogPosts (contentType) by title **/
        .addAnd('title', 'like', '%Hello%', 'fields', 'blogPosts')
        
        // syntax
        // .addAnd(property: string(<id|title|...>), operator: string(<equals|like|...>), value: any, context: string(<fields|meta>), contentType: string(<*|contentTypeApiId>))
        // .addOr(property: string(<id|title|...>), operator: string(<equals|like|...>)), value: any, context: string(<fields|meta>), contentType: string(<*|contentTypeApiId>))
}

api.getDocuments(options)
  .then(result => {
    // futher implementation
  })
  .catch(err => {
    throw err;
  })
```


---

# 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://docs.comfortable.io/sdk/javascript/example-filters.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.
