# Query Options

## **limit**

**Type:** `number`\
\
defines the maximum number of documents that the API will return for your query.\
`default: 25`  `max: 1000`

**Example usage:**

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

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

**Available for:**

* [Query all Documents](/sdk/javascript/query-all-documents.md)
* [Query a Collection](/sdk/javascript/query-a-collection.md)

## **offset**

**Type:** `number`\
defines the number of documents which gets skipped in the datasets.\
`default: 0`&#x20;

**Example usage:**

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

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

**Available for:**

* [Query all Documents](/sdk/javascript/query-all-documents.md)
* [Query a Collection](/sdk/javascript/query-a-collection.md)

## **locale**

**Type:** `string` \
set the Language for  the receiving documents. \
`locale: 'en'` \
to receive all languages, set `locale: 'all'`

**Example usage:**

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

api.getDocuments({
  locale: 'en'
})
  .then(result => {
    // futher implementation
  })
  .catch(err => {
    throw err;
  })
```

**Available for:**

* [Query all Documents](/sdk/javascript/query-all-documents.md)
* [Query a Collection](/sdk/javascript/query-a-collection.md)
* [Query a Single Document](/sdk/javascript/query-a-single-document.md)
* [Query and Alias](/sdk/javascript/query-an-alias.md)
* [Query an Asset](/sdk/javascript/query-an-asset.md)

## **includes**

**Type:** `number`  or `Comfortable.Include` \
defines the aggregation level of related documents\
or pick specific relations which should be aggregated in the query results&#x20;

**Example picking specific relations:**

```javascript
var options = {
    includes: new Comfortable.Include()
        .add('relatedNews')
}
```

**Example with aggregation level:**

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

api.getDocuments({
  includes: 2 // aggregation level
})
  .then(result => {
    // futher implementation
  })
  .catch(err => {
    throw err;
  })
```

**Available for:**

* [Query all Documents](/sdk/javascript/query-all-documents.md)
* [Query a Collection](/sdk/javascript/query-a-collection.md)
* [Query a Single Document](/sdk/javascript/query-a-single-document.md)
* [Query and Alias](/sdk/javascript/query-an-alias.md)
* [Query an Asset](/sdk/javascript/query-an-asset.md)

## **includeTags**

**Type:** `array` \
include documents with certain tags to the query results.

**Example usage:**

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

api.getDocuments({
  includeTags: ['include', 'me']
})
  .then(result => {
    // futher implementation
  })
  .catch(err => {
    throw err;
  })
```

**Available for:**

* [Query all Documents](/sdk/javascript/query-all-documents.md)
* [Query a Collection](/sdk/javascript/query-a-collection.md)

## **excludeTags**

**Type:** `array` \
exclude documents with certain tags from the query results.

**Example usage:**

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

api.getDocuments({
  excludeTags: ['exclude', 'this']
})
  .then(result => {
    // futher implementation
  })
  .catch(err => {
    throw err;
  })
```

**Available for:**

* [Query all Documents](/sdk/javascript/query-all-documents.md)
* [Query a Collection](/sdk/javascript/query-a-collection.md)

## **fields**

**Type:** `string` \
hiding/masking specific fields/parts from the query result.

```javascript
var options = {
    fields: 'meta,fields(title,date)'
}
```

**Example usage:**

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

api.getDocuments({
  fields: 'meta,fields(title)'
})
  .then(result => {
    // futher implementation
  })
  .catch(err => {
    throw err;
  })
```

**Available for:**

* [Query all Documents](/sdk/javascript/query-all-documents.md)
* [Query a Collection](/sdk/javascript/query-a-collection.md)
* [Query a Single Document](/sdk/javascript/query-a-single-document.md)
* [Query and Alias](/sdk/javascript/query-an-alias.md)
* [Query an Asset](/sdk/javascript/query-an-asset.md)

## **embedAssets**

**Type:** `boolean` \
embeds assets to the document which points on them.

**Example usage:**

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

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

**Available for:**

* [Query all Documents](/sdk/javascript/query-all-documents.md)
* [Query a Collection](/sdk/javascript/query-a-collection.md)
* [Query a Single Document](/sdk/javascript/query-a-single-document.md)
* [Query and Alias](/sdk/javascript/query-an-alias.md)

## **filters**

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

**Example usage:**

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

api.getDocuments({
  filters: new Comfortable.Filter()
        .addAnd('title', 'like', '%Hello%')
        .addAnd('date', 'greaterThan', '2018-07-04')
        .addOr('topNews', 'equal', true)
})
  .then(result => {
    // futher implementation
  })
  .catch(err => {
    throw err;
  })
```

**Available for:**

* [Query all Documents](/sdk/javascript/query-all-documents.md)
* [Query a Collection](/sdk/javascript/query-a-collection.md)

## **sorting**

**Type:** `Comfortable.Sorting` \
sort query results ascending or descending by certain fields

**Example usage:**

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

api.getDocuments({
  sorting: new Comfortable.Sorting()
    .add('date', 'asc')
    .add('title', 'asc')
})
  .then(result => {
    // futher implementation
  })
  .catch(err => {
    throw err;
  })
```

**Available for:**

* [Query all Documents](/sdk/javascript/query-all-documents.md)
* [Query a Collection](/sdk/javascript/query-a-collection.md)

## **search**

**Type:** `string`&#x20;

**Example usage:**

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

api.getDocuments({
  search: 'sport -football +soccer'
})
  .then(result => {
    // futher implementation
  })
  .catch(err => {
    throw err;
  })
```

**Available for:**

* [Query all Documents](/sdk/javascript/query-all-documents.md)
* [Query a Collection](/sdk/javascript/query-a-collection.md)


---

# 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/query-options.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.
