---
title: "Query"
description: "Query"
url: "https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/react-native/reference/query"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-13"
---

# Query

## Query

An initializer is responsible for creating Query object. Provides support for all search queries

## addParam

Includes query parameters in your queries.

```
import Contentstack from 'contentstack'

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().addParam('include_count', 'true').toJSON().find()
```

## notEqualTo

Retrieves entries in which the value for a field does not match the provided value.

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().notEqualTo('title', 'some random title').toJSON().find();
```

UID of the field

Value used to match or compare

## containedIn

Retrieve entries in which the value of a field matches with any of the provided array of values

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().containedIn('title', ['Demo', 'Welcome']).toJSON().find();
```

UID of the field

Array of values that are to be used to match or compare

## notContainedIn

Retrieve entries in which the value of a field does not match with any of the provided array of values.

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().notContainedIn('title', ['Demo', 'Welcome']).toJSON().find();
```

UID of the field

Array of values that are to be used to match or compare

## and

Retrieve entries that satisfy all the provided conditions.

```
and with Query instances:
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});

const Query1 = Stack.ContentType('content_type_1').Query().where('title', 'demo');
const Query2 = Stack.ContentType('content_type_1').Query().lessThan('age', 30);

const result = await Stack.ContentType('content_type_uid').Query().and(Query1, Query2).toJSON().find();
and with raw queries:
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});

const Query1 = Stack.ContentType('content_type_1').Query().where('title', 'demo').getQuery();
const Query2 = Stack.ContentType('content_type_1').Query().lessThan('age', 30).getQuery();

const result = await Stack.ContentType('content_type_uid').Query().and(Query1, Query2).toJSON().find();
```

array of Query objects or raw queries

## or

Retrieves entries that satisfy at least one of the given conditions

```
or with Query instances:
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});

const Query1 = Stack.ContentType('content_type_1').Query().where('title', 'demo');
const Query2 = Stack.ContentType('content_type_1').Query().lessThan('age', 30);

const result = await Stack.ContentType('content_type_uid').Query().or(Query1, Query2).toJSON().find();
or with raw queries:
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});

const Query1 = Stack.ContentType('content_type_1').Query().where('title', 'demo').getQuery();
const Query2 = Stack.ContentType('content_type_1').Query().lessThan('age', 30).getQuery();

const result = await Stack.ContentType('content_type_uid').Query().or(Query1, Query2).toJSON().find();
```

array of Query objects or raw queries

## lessThan

Retrieves entries in which the value of a field is lesser than the provided value

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().lessThan('age', 20).toJSON().find();
```

UID of the field

Value used to match or compare

## lessThanOrEqualTo

Retrieves entries in which the value of a field is lesser than or equal to the provided value.

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().lessThanOrEqualTo('age', 20).toJSON().find();
```

UID of the field

Value used to match or compare

## greaterThanOrEqualTo

Retrieves entries in which the value for a field is greater than or equal to the provided value.

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().greaterThanOrEqualTo('age', 20).toJSON().find();
```

UID of the field

Value used to match or compare

## limit

Returns a specific number of entries based on the set limit

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().limit(20).toJSON().find();
```

maximum number of entries to be returned

## ascending

Sort fetched entries in the ascending order with respect to a specific field.

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().ascending('field_uid').toJSON().find();
```

field uid based on which the ordering will be done

## descending

Sort fetched entries in the descending order with respect to a specific field

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().descending('field_uid').toJSON().find();
```

field uid based on which the ordering will be done

## exists

Retrieve entries if value of the field, mentioned in the condition, exists.

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().exists('field_uid').toJSON().find();
```

UID of the field

## notExists

Retrieve entries if value of the field, mentioned in the condition, does not exists.

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().notExists('field_uid').toJSON().find();
```

UID of the field

## only

Displays values of only the specified fields of entries or assets in the response

```
The only function with field_uid will include the data of only the specified fields for each entry and exclude the data of all other fields.
import Contentstack from 'contentstack'; 
const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().only('title').toJSON().find();


The only function with an array of field_uids will include multiple fields for each entry and exclude the data of all other fields.
import Contentstack from 'contentstack';
const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().only(['title', 'description']).toJSON().find();


In only, we have the only with a reference parameter, where you need to enter the UID of the reference field in place of "reference_field_uid", and the second parameter to include the data of only the specified field_uid for each entry and exclude the data of all other fields.
import Contentstack from 'contentstack';
const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeReference('reference_field_uid').only('reference_field_uid','title').toJSON().find();


In only, we have the only with a reference parameter with an array, where you need to enter the UID of the reference field in place of "reference_field_uid", and the second parameter with an array of fields to include the data of only the specified array of field_uids for each entry and exclude the data of all other fields.
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeReference('reference_field_uid').only('reference_field_uid',['title', 'description']).toJSON().find();
```

## except

Displays all data of an entries or assets excluding the data of the specified fields.

```
The except function with field_uid will exclude the data of only the specified fields for each entry and includes the data of all other fields.
import Contentstack from 'contentstack'; 
const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().except('title').toJSON().find();


The except function with an array of field_uids will except multiple fields for each entry and include the data of all other fields.
import Contentstack from 'contentstack';
const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().except(['title', 'description']).toJSON().find();


In except, we have the only with a reference parameter, where you need to enter the UID of the reference field in place of "reference_field_uid", and the second parameter to except the data of only the specified field_uid for each entry and include the data of all other fields.
import Contentstack from 'contentstack';
const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeReference('reference_field_uid').except('reference_field_uid','title').toJSON().find();

In except, we have the only with a reference parameter with an array, where you need to enter the UID of the reference field in place of "reference_field_uid", and the second parameter with an array of fields to except the data of only the specified array of field_uids for each entry and include the data of all other fields.
import Contentstack from &'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeReference('reference_field_uid').except('reference_field_uid',['title', 'description']).toJSON().find();
```

## regex

Retrieve entries that match the provided regular expressions

```
regex without options
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().regex('title', '^Demo').toJSON().find();
regex with options
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().regex('title', '^Demo', 'i').toJSON().find();
```

uid of the field

value used to match or compare

match or compare value in entry

## tags

Retrieves entries based on the provided tags

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().tags(['technology', 'business']).toJSON().find();
```

array of tags

## includeReference

Fetches the entire content of referenced entry.

```
Include Reference with reference_field_uids as array:
import Contentstack from 'contentstack'

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeReference(['reference_field_uid','other_reference_field_uid']).toJSON().find();

Include Reference with reference_field_uids and its children reference
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeReference(['reference_field_uid', 'reference_field_uid.child_reference_field_uid']).toJSON().find();

Include Reference with reference_field_uid:
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeReference('reference_field_uid').toJSON().find();
```

## referenceIn

Retrieve entries based on raw queries

```
referenceIn with Query instances
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});

const Query1 = Stack.ContentType('content_type_1').Query().where('title', 'Demo');

const result = await Stack.ContentType('content_type_uid').Query().referenceIn('brand', Query1).toJSON().find();
referenceIn with raw queries:
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});

const result = await Stack.ContentType('content_type_uid').Query().referenceIn('brand', {'title': 'Demo'}).toJSON().find();
```

Reference field Uid

RAW (JSON) queries

## referenceNotIn

Retrieve entries based on raw queries

```
referenceNotIn with Query instances:
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});

const Query1 = Stack.ContentType('content_type_1').Query().where('title', 'Demo');

const result = await Stack.ContentType('content_type_uid').Query().referenceNotIn('brand', Query1).toJSON().find();

referenceNotIn with raw queries:
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().referenceNotIn('brand', {'title': 'Demo'}).toJSON().find();
```

Reference field Uid

RAW (JSON) queries

## includeReferenceContentTypeUID

This method also includes the content type UIDs of the referenced entries returned in the response.

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeReferenceContentTypeUID().toJSON().find();
```

## includeCount

Includes the total number of entries returned in the response.

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeCount().toJSON().find();
```

## includeContentType

Include the details of the content type along with the entry/entries details.

```
import Contentstack from 'contentstack'

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeContentType().toJSON().find();
```

## includeBranch

Include the Branch for publish content.

```
import Contentstack from 'contentstack'

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeBranch().toJSON().find();
```

## includeEmbeddedItems

Include Embedded Objects (Entries and Assets) along with entry/entries details.

```
import Contentstack from 'contentstack'

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().includeEmbeddedItems().toJSON().find();
```

## includeFallback

Include the fallback locale publish content, if specified locale content is not publish.

```
import Contentstack from 'contentstack'

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
Stack.ContentType('content_type_uid;).Query().includeFallback().fetch()
```

## query

Retrieve entries based on raw queries

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().query({'brand': {'$nin_query': {'title': 'Apple Inc.'}}}).toJSON().find();
```

RAW (JSON) queries

## addQuery

Adds query to Entry object

```
import Contentstack from 'contentstack'

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().addQuery('include_content_type', true).toJSON().find();
```

Key of the query

Value of the query

## getQuery

Returns the raw (JSON) query based on the filters applied on Query object.

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const rawQuery = await Stack.ContentType('content_type_uid').Query().where('title', 'Demo').getQuery();
```

## language

Sets the language code of which you want to retrieve data.

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().language('language_code').toJSON().find();
```

language code. e.g. 'en-us', 'ja-jp', etc.

## find

Retrieves entries that satisfied the specified query

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().toJSON().find();
```

Fetch options to fetch particular query

## findOne

Retrieves entries that satisfied the specified query

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().toJSON().findOne();
```

Fetch options to fetch particular query

## count

Returns the total number of entries

```
import Contentstack from 'contentstack';

const Stack = Contentstack.Stack({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack.ContentType('content_type_uid').Query().count().toJSON().find();
```

## equalAndBelow

The equalAndBelow method retrieves all entries for a specific taxonomy that match a specific term and all its descendant terms, requiring only the target term.

**Note**: This query is applicable for the stack.Taxonomies() and stack.ContentType('uid').Query() methods.

```
Example:
let data;
stack
.ContentType('ct_uid')
.Query()
.equalAndBelow("taxonomies.taxonomy_uid", "term_uid", 3)
.toJSON()
.find()
.then(response => {
  // the response
  data = response;
})
```

UID of the taxonomy field, specified as taxonomies.<taxonomy\_uid>

UID of the term to match or compare

Depth level till which terms will be matched

## below

The below method retrieves all entries for a specific taxonomy that match all of their descendant terms by specifying only the target term and a specific level.

**Note**: If you don't specify the level, the default behavior is to retrieve terms up to level 10.

```
Example:
let data;
stack
.ContentType('ct_uid')
.Query()
.below("taxonomies.taxonomy_uid", "term_uid", 3)
.toJSON()
.find()
.then(response => {
  // the response
  data = response;
})
```

UID of the taxonomy field, specified as taxonomies.<taxonomy\_uid>

UID of the term to match or compare

Depth level till which terms will be matched

## equalAndAbove

The equalAndAbove method retrieves all entries for a specific taxonomy that match a specific term and all its ancestor terms, requiring only the target term and a specified level.

**Note**: If you don't specify the level, the default behavior is to retrieve terms up to level 10.

```
Example:
let data;
stack
.Taxonomies()
.equalAndAbove("taxonomies.taxonomy_uid", "term_uid", 3)
.toJSON()
.find()
.then(response => {
  // the response
  data = response;
})
```

UID of the taxonomy field, specified as taxonomies.<taxonomy\_uid>

UID of the term to match or compare

Depth level till which terms will be matched

## above

The above method retrieves all entries for a specific taxonomy that match only the parent term(s) of a specified target term, excluding the target term itself and a specified level.

**Note**: If you don't specify the level, the default behavior is to retrieve terms up to level 10.

```
Example:
let data;
stack
.ContentType('ct_uid')
.Query()
.above("taxonomies.taxonomy_uid", "term_uid", 3)
.toJSON()
.find()
.then(response => {
  // the response
  data = response;
})
```

UID of the taxonomy field, specified as taxonomies.<taxonomy\_uid>

UID of the term to match or compare

Depth level till which terms will be matched

## Query

## Query | React Native Delivery SDK | Contentstack

The Query class in the React Native Delivery SDK creates query objects and supports all search queries for retrieving entries from Contentstack.