> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Resource: Items # Type: WixDataQuery # Action: limit # Link: https://dev.wix.com/docs/sdk/business-solutions/data/items/wix-data-query/limit.md ## Description: Limits the number of items the query returns. The `limit()` method defines the number of results a query returns in each page. Only one page of results is retrieved at a time. The `next()` and `prev()` methods are used to navigate the pages of a query result. By default, `limit` is set to `50`. The maximum value that `limit()` can accept is `1000`. Note that for some [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md), the maximum value `limit()` can accept is less than `1000`. For example, the maximum limit for the Wix `Stores/Product` collection is 100. ## Schema: ```json Method: limit(limitNumber) Description: Limits the number of items the query returns. The `limit()` method defines the number of results a query returns in each page. Only one page of results is retrieved at a time. The `next()` and `prev()` methods are used to navigate the pages of a query result. By default, `limit` is set to `50`. The maximum value that `limit()` can accept is `1000`. Note that for some [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md), the maximum value `limit()` can accept is less than `1000`. For example, the maximum limit for the Wix `Stores/Product` collection is 100. Method parameters: param name: limitNumber | type: number | description: Number of items to return, which is also the `pageSize` of the results object. Return type: REFERENCE Method: and(filter) Description: Adds an `and` condition to the query or filter. The `and()` method adds an and condition to this query. A query or filter with an `and` returns all the items that match the query or filter as defined up to the `and` method and also match the query or filter passed to the `and` method. Note that when chaining multiple `WixDataFilter` methods to a query an and condition is assumed. In such cases, you do not need to add a call to the `and()` method. For example, this query returns results where status is active **and** age is greater than 25. ```js items.query("myCollection").eq("status", "active").gt("age", 25); ``` The `and()` method is needed when performing compound queries. For example, the final query in this set of queries returns results where status is either pending or rejected **and** age is either less than 25 or greater than 65. ```js let statusQuery = items .query("myCollection") .eq("status", "pending") .or(items.filter().eq("status", "rejected")); let ageQuery = items .filter() .lt("age", 25) .or(items.filter().gt("age", 65)); let statusAndAgeQuery = statusQuery.and(ageQuery); ``` The `and()` method is designed to work with 2 or more queries or filters. When used on its own, it returns all the items in a collection. Method parameters: param name: filter | type: WixDataFilter | description: Filter to add to the initial query as an `and` condition. Method: and(filter) Description: Adds an `and` condition to the filter. A filter with an `and` condition returns all items that meet the conditions defined on both sides of the condition. Use the `and()` method when performing compound queries. For example, the final filter in this set of queries returns results where status is either pending or rejected **and** age is either less than 25 or greater than 65. ```js let statusFilter = items.filter() .eq("status", "pending") .or(items.filter().eq("status", "rejected")); let ageFilter = items.filter() .lt("age", 25) .or(items.filter().gt("age", 65)); let statusAndAgeFilter = statusFilter.and(ageFilter); ``` > **Notes**: > - The `and()` method is designed to work with 2 or more queries or filters. If used with a single query or filter, it returns all items in a collection. > - When chaining multiple `WixDataFilter` methods to a filter, an `and` condition is implied. In such cases, you do not need to call the `and()` method explicitly. For example, this filter returns results where an item `status` is `active` and `age` is greater than 25: > ```js > items.filter().eq("status", "active").gt("age", 25); > ``` Method parameters: param name: filter | type: WixDataFilter | description: `WixDataFilter` used with an `and` condition. Return type: REFERENCE Method: between(field, rangeStart, rangeEnd) Description: Refines a filter to match items where the value of the specified field is within the defined range. The `between()` method refines this filter to match items for which the value of the specified field is greater than or equal to `rangeStart` and less than `rangeEnd`. The method only compares values of [the same type](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type). The following types can be compared: - Number: Compared numerically. - Date: Compared as JavaScript Date objects. - String: Compared lexicographically: - `"A"` and `"M"` are considered between `"A"` and `"Z"`, but `"a"`, `"m"`, `"z"` and `"Z"` are not. - `"A"`, `"M"`, `"Z"`, and `"a"` are considered between `"A"` and `"z"`, but `"z"` is not. > **Note**: Items that do not have a value for the specified field are considered as the lowest comparable value and are ranked last. Method parameters: param name: field | type: string | description: Field to compare with `rangeStart` and `rangeEnd`. param name: rangeStart | type: undefined | description: Starting value of the range to match. param name: rangeEnd | type: undefined | description: Ending value of the range to match. Return type: REFERENCE Method: contains(field, value) Description: Refines a filter to match items where the value of the specified field contains the specified value. The `contains()` method refines the filter to only match items for which the value of the specified field contains the specified value. `contains()` is not case-sensitive, so the value `sunday` is considered to contain the value `Sun`. You can use `contains()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md) is a string or a reference. When specifying a field of type reference, `contains()` matches by the GUID of the referenced item as a string. To compare by other data types, use the [`eq()`](https://dev.wix.com/docs/sdk/backend-modules/data/wix-data-items-sdk-1-0-0/wix-data-filter/eq.md) method. Method parameters: param name: field | type: string | description: Field whose value is compared with the provided value. param name: value | type: string | description: Value to locate in the specified field. Return type: REFERENCE Method: endsWith(field, value) Description: Refines a filter to match items where the value of the specified field ends with a specified value. The `endsWith()` method refines this filter to only match items where the value of the specified field ends with the specified value. Matching with `endsWith()` is not case sensitive, so `"TEXT"` is considered to end with `"ext"`. You can only use `endsWith()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md) string or reference. When specifying a field of type reference, `endsWith()` matches by the GUID of the referenced item as a string. Method parameters: param name: field | type: string | description: Field whose value is compared with the specified value. param name: value | type: string | description: Value to look for at the end of the specified field value. Return type: REFERENCE Method: eq(field, value) Description: Refines a filter to match items where the value of the specified field equals the specified value. The `eq()` method refines this filter to only match items where the value of the specified field equals the specified `value`. Values of different [types](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md) are always considered not equal. For example, a number value stored as a string does not match the same number stored as a number. Matching strings with `eq()` is case sensitive, so `"text"` is not equal to `"Text"`. If `field` points to a collection field of type array, `eq()` includes the item as long as at least one array element matches the specified `value`. Method parameters: param name: field | type: string | description: Field whose value is compared with `value`. param name: value | type: any | description: Value to compare with. Return type: REFERENCE Method: ge(field, value) Description: Refines a filter to match items where the value of the specified field is greater than or equal to the specified value. The `ge()` method refines this filter to only match items where the value of the specified field is greater than or equal to the specified value. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a string does not match the same number stored as a number. If a field contains a number as a string, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest. The following field types can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so `"abc"` is greater than or equal to `"ABC"` (because of the greater than), but `"ABC"` is not greater than or equal to `"abc"`. - Reference: Compares by the GUID of the referenced item as a string. Method parameters: param name: field | type: string | description: Field whose value is compared with the specified value. param name: value | type: undefined | description: Value to match. Return type: REFERENCE Method: gt(field, value) Description: Refines a filter to match items where the value of the specified field is greater than the specified value. The `gt()` method refines this filter to only match items where the value of the specified field is greater than the specified value. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a string does not match the same number stored as a number. If a field contains a number as a string, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest. The following field types can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so `"text"` is greater than `"Text"`. - Reference: Compares by the GUID of the referenced item as a string. Method parameters: param name: field | type: string | description: Field whose value is compared with the specified value. param name: value | type: undefined | description: Value to match. Return type: REFERENCE Method: hasAll(field, values) Description: Refines a filter to match items where the values of the specified field contain all of the specified values. The `hasAll()` method refines this filter to only match items where the specified field contains all of the specified values. Matching strings with `hasAll()` is case sensitive, so `"text"` is not equal to `"Text"`. If the value of the specified field is an array, `hasAll()` will match if there is a match in the elements of that array for all of the specified values. You can specify a list of values to match by providing an array of String, Number, or Date types as the `value` parameters. Method parameters: param name: field | type: string | description: Field whose value is compared with `values`. param name: values | type: undefined | description: Values to match. Return type: REFERENCE Method: hasSome(field, values) Description: Refines a filter to match items where the values of the specified field contain any of the specified values. The `hasSome()` method refines this filter to only match items where the specified field contains any of the specified values. Matching strings with `hasSome()` is case sensitive, so `"text"` is not equal to `"Text"`. If the value of the specified field is an array, `hasSome()` will match if any of the elements of that array match any of the specified values. If the specified field contains multiple references, pass item GUIDs in the `value` field. In such a case, `hasSome()` will match if any of the multiple references match any of the specified GUID values. You can specify a list of values to match by providing an array of String, Number, or Date types as the `value` parameters. Method parameters: param name: field | type: string | description: Field whose value is compared with `value`. param name: values | type: undefined | description: Values to match. Return type: REFERENCE Method: isEmpty(field) Description: Refines a filter to match items whose specified field does not exist or does not have any value. The `isEmpty()` method refines this filter to only match items where the value of the specified field is `null` or `undefined` or the field does not exist. If the field contains any value at all for a given item, including the empty string or an invalid value, that item will match the filter. Method parameters: param name: field | type: string | description: Field to check for a value. Return type: REFERENCE Method: isNotEmpty(field) Description: Refines a filter to match items whose specified field has any value. The `isNotEmpty()` method refines this filter to only match items where the value of the specified field is not `null` or `undefined`. If the field contains any value at all for a given item, including the empty string or an invalid value, that item will match the filter. Method parameters: param name: field | type: string | description: Field to check for a value. Return type: REFERENCE Method: le(field, value) Description: Refines a filter to match items where the value of the specified field is less than or equal to the specified value. The `le()` method refines this filter to only match items where the value of the specified field is less than or equal to the specified value. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a string does not match the same number stored as a number. If a field contains a number as a string, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest. The following field types can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so `"ABC"` is less than or equal to `"abc"` (because of the less than), but `"abc"` is not less than or equal to `"ABC"`. - Reference: Compares by the GUID of the referenced item as a string. Method parameters: param name: field | type: string | description: Field whose value is compared with the specified value. param name: value | type: undefined | description: Value to match. Return type: REFERENCE Method: lt(field, value) Description: Refines a filter to match items where the value of the specified field is less than the specified value. The `lt()` method refines this filter to only match items where the value of the specified field is less than the specified `value`. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a string does not match the same number stored as a number. If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest. The following field types can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so `"Text"` is less than `"text"`. - Reference: Compares by the GUID of the referenced item as a String. Method parameters: param name: field | type: string | description: Field whose value is compared with `value`. param name: value | type: undefined | description: Value to match. Return type: REFERENCE Method: ne(field, value) Description: Refines a filter to match items where the value of the specified field does not equal the specified value. The `ne()` method refines this filter to only match items where the value of the specified field does not equal the specified value. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a string is considered not equal to the same number stored as a number. Matching strings with `ne()` is case sensitive, so `"text"` is considered not equal to `"Text"`. If the value of `field` is an array, `ne()` matches items where none of the elements of the array match the specified value. Method parameters: param name: field | type: string | description: Field whose value is compared with `value`. param name: value | type: any | description: Value to match. Return type: REFERENCE Method: not(filter) Description: Adds a `not` condition to the filter. The `not()` method adds a `not` condition to this filter. A filter with a `not` returns all the items that match the filter as defined up to the `not` method, but don't match the filter passed to the `not` method. If the filter only contains a `not()` method, it returns all the items that don't match the filter defined by the `not` method. Method parameters: param name: filter | type: WixDataFilter | description: Filter to add to the initial filter as a `not` condition. Return type: REFERENCE Method: or(filter) Description: Adds an `or` condition to the filter. The `or()` method adds an inclusive `or` condition to this filter. A filter with an `or` returns all the items that match the filter as defined up to the `or` method, the items that match the filter passed to the `or` method, and the items that match both. The `or()` method is designed to work with 2 or more queries or filters. If you use it on its own, it will return all the items in a collection. Method parameters: param name: filter | type: WixDataFilter | description: Filter to add to the initial filter as an `or` condition. Return type: REFERENCE Method: startsWith(field, value) Description: Refines a filter to match items where the value of the specified field starts with a specified value. The `startsWith()` method refines this filter to only match items where the value of the specified field starts with the specified value. Matching with `startsWith()` is not case sensitive, so specifying `"TEXT"` is considered to start with `"tex"`. You can only use `startsWith()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md) string or reference. When specifying a field of type reference, `startsWith()` matches by the GUID of the referenced item as a string. Method parameters: param name: field | type: string | description: Field whose value is compared with the specified value. param name: value | type: string | description: Value to look for at the beginning of the specified field value. Return type: REFERENCE Return type: REFERENCE Method: ascending(fields) Description: Adds a sort to a query or sort, sorting by the specified properties in ascending order. The `ascending()` method refines this query in ascending order of the specified properties. If you specify more than one property, `ascending()` sorts the results in ascending order by each property in the order they are listed. You can sort the following types: - Number: Sorts numerically. - Date: Sorts by date and time. - String: Sorts lexicographically, so `"abc"` comes after `"XYZ"`. - Reference: Compares by the GUID of the referenced item as a String. If a property contains a number as a String, that value is sorted alphabetically and not numerically. Items that do not have a value for the specified sort property are ranked lowest. Method parameters: param name: fields | type: Array | description: Fields to sort by. Return type: REFERENCE Method: between(field, rangeStart, rangeEnd) Description: Refines a query to match items whose specified property value is within a specified range. The `between()` method refines this query to only match items where the value of the specified property is greater than or equal to `rangeStart` and less than `rangeEnd`. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a number does not match the same number stored as a string. If a property contains a number as a string, that value is compared alphabetically and not numerically. Items that do not have a value for the specified property are ranked lowest. The following types of properties can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so - `"A"` and `"M"` are between `"A"` and `"Z"`, but `"a"`, `"m"`, `"z"` and `"Z"` are not. - `"A"`, `"M"`, `"Z"`, and `"a"` are between `"A"` and `"z"`, but `"z"` is not. Method parameters: param name: field | type: string | description: Field whose value is compared with rangeStart and rangeEnd. param name: rangeStart | type: undefined | description: Starting value of the range to match. param name: rangeEnd | type: undefined | description: Ending value of the range to match. Return type: REFERENCE Method: contains(field, value) Description: Refines a query to match items whose specified field value contains a specified value. The `contains()` method refines this query to only match items where the value of the specified field contains the specified value. Matching with `contains()` is not case sensitive, so `"text"` does contain `"Tex"`. You can use `contains()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md) string or reference. When specifying a field of type reference, `contains()` matches by the GUID of the referenced item as a string. Method parameters: param name: field | type: string | description: Field whose value is compared with the specified value. param name: value | type: string | description: The string to look for inside the specified field value. Return type: REFERENCE Method: count(options) Description: Returns the number of items that match the query. The `count()` method returns a Promise that resolves to the number of items that match the query. The Promise is rejected if `count()` is called with incorrect permissions or if any of the methods used to refine the query is invalid. Calling the `count()` method triggers the [`beforeCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-count.md) and [`afterCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-count.md) hooks if they have been defined. Use the `options` parameter to run `count()` without checking for permissions or without its registered hooks. Any method that does not filter query results (e.g., [`ascending()`](#ascending)) does not affect the result of `count()`. If you build a query and don't refine it with any `WixDataQuery` methods, `count()` returns the total number of items in the collection. > **Note**: You can also retrieve the number of query results by calling `find()` and setting the `options.returnTotalCount` property to `true`. Method parameters: param name: options | type: WixDataReadOptions | description: Options to use when processing this operation. - name: appOptions | type: Record | description: Options for [querying Wix app collections](https://dev.wix.com/docs/develop-websites/articles/wix-apps/wix-app-collections/querying-wix-app-collections.md). - name: consistentRead | type: boolean | description: When `true`, reads data from the primary database instance. This decreases performance but ensures data retrieved is up-to-date even immediately after an update. Learn more about [Wix Data and eventual consistency](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency.md). - name: language | type: string | description: Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. If provided, the result text is returned in the specified language. If not provided, the result text is not translated. > **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual). - name: showDrafts | type: boolean | description: When `true`, operations include draft items. Read operations include draft items in their response, and write operations modify draft items. Default: `false`. - name: suppressHooks | type: boolean | description: Prevents hooks from running for the operation. Can only be used in the [backend code of a Wix site](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/backend-code/about-the-site-backend.md). Default: `false`. Return type: PROMISE Method: descending(fields) Description: Adds a sort to a query or sort, sorting by the specified properties in descending order. The `descending()` method refines this query to sort in descending order of the specified properties. If you specify more than one property, descending() sorts the results in descending order by each property in the order they are listed. You can sort the following types: Number: Sorts numerically. - Date: Sorts by date and time. - String: Sorts lexicographically, so `"abc"` comes before `"XYZ"`. - Reference: Compares by the GUID of the referenced item as a String. If a property contains a number as a String, that value is sorted alphabetically and not numerically. Items that do not have a value for the specified sort property are ranked lowest. Method parameters: param name: fields | type: Array | description: Fields to sort by. Return type: REFERENCE Method: distinct(field, options) Description: Returns the distinct values that match the query, without duplicates. The `distinct()` method returns a Promise that resolves to: - The distinct values found in the specified field when running the query. - Additional information about the results, such as the number of values that match the query. Unlike `find()`, which returns all item objects that match the query, `distinct()` returns matching field values, and eliminates duplicate field values from the query result. You cannot use `find()` and `distinct()` together. For an item to be resolved as distinct, only the specified field must be distinct. Other fields for that item in the collection are not evaluated when resolving the promise. The Promise is rejected if `distinct()` is called with incorrect permissions or if any of the methods used to refine the query is invalid. >**Note:** Only site visitors with [Data Read](https://support.wix.com/en/article/collection-permissions-an-overview#permissions) permissions can retrieve and view data. You can override the permissions by calling this method with [elevated permissions](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-elevated-permissions.md). Method parameters: param name: field | type: string | description: Field whose value is compared for distinct values. param name: options | type: WixDataQueryOptions | description: Configuration options for building the query. - name: appOptions | type: Record | description: Options for [querying Wix app collections](https://dev.wix.com/docs/develop-websites/articles/wix-apps/wix-app-collections/querying-wix-app-collections.md). - name: consistentRead | type: boolean | description: When `true`, reads data from the primary database instance. This decreases performance but ensures data retrieved is up-to-date even immediately after an update. Learn more about [Wix Data and eventual consistency](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency.md). - name: language | type: string | description: Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. If provided, the result text is returned in the specified language. If not provided, the result text is not translated. > **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual). - name: returnTotalCount | type: boolean | description: When `true`, the query results include a `totalCount` and `totalPages` properties containing the totals of items matching query. Requesting total count slows down the query. Default: `false` - name: showDrafts | type: boolean | description: When `true`, operations include draft items. Read operations include draft items in their response, and write operations modify draft items. Default: `false`. - name: suppressHooks | type: boolean | description: Prevents hooks from running for the operation. Can only be used in the [backend code of a Wix site](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/backend-code/about-the-site-backend.md). Default: `false`. Return type: PROMISE - name: currentPage | type: number | description: Returns the index of the current results page number. The `currentPage` is a zero-based index of the current page of results. The page size is defined by the `limit()` method, can be retrieved using the `pageSize` property, and navigating through pages is done with the `prev()` and `next()` methods. The `currentPage` property returns `undefined` if the query returned no results. - name: items | type: Array | description: Returns the items that match the query. The current page of items retrieved by the query. The page size is defined by the `limit()` method, can be retrieved using the `pageSize` property, and navigating through pages is done with the `prev()` and `next()` methods. When no items match the query, the `items` array is empty. - name: length | type: number | description: Returns the number of items in the current results page. The page size is defined by the `limit()` method, can be retrieved using the `pageSize` property, and navigating through pages is done with the `prev()` and `next()` methods. - name: pageSize | type: number | description: Returns the query page size. The page size is defined by the `limit()` method, can be retrieved using the `pageSize` property, and navigating through pages is done with the `prev()` and `next()` methods. - name: totalCount | type: number | description: Returns the total number of items that match the query. The `totalCount` returns the total number of items that match the query, not just the number of items in the current page. > **Note:** This property is only available when the query's `options.returnTotalCount` parameter is set to `true`. - name: totalPages | type: number | description: Returns the total number of pages the query produced. The page size is defined by the `limit()` method, can be retrieved using the `pageSize` property, and navigating through pages is done with the `prev()` and `next()` methods. > **Note:** This property is only available when the query's `options.returnTotalCount` parameter is set to `true`. Method: hasNext() Description: Indicates if the query has more results. Return type: PRIMITIVE Method: hasPrev() Description: Indicates the query has previous results. Return type: PRIMITIVE Method: next() Description: Retrieves the next page of query results. The `next()` method retrieves the next page of query results. The page size is defined by the `limit()` method, can be retrieved using the `pageSize` property, and navigating through pages is done with the `prev()` and `next()` methods. If items are added or removed between calls to `next()` the values returned may change. >**Note:** The `next()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection). Return type: PROMISE Method: prev() Description: Retrieves the previous page of query results. The `prev()` method retrieves the previous page of query results. The page size is defined by the `limit()` method, can be retrieved using the `pageSize` property, and navigating through pages is done with the `prev()` and `next()` methods. If items are added or removed between calls to `prev()` the values returned may change. >**Note:** The `prev()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection). Return type: PROMISE Method: endsWith(field, value) Description: Refines a query to match items whose specified property value ends with a specified value. The `endsWith()` method refines this query to only match items where the value of the specified field ends with the specified value. Matching with `endsWith()` is not case sensitive, so `"TEXT"` is considered to end with `"ext"`. You can only use `endsWith()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md) string or reference. When specifying a field of type reference, `endsWith()` matches by the GUID of the referenced item as a string. Method parameters: param name: field | type: string | description: Field whose value is compared with the specified value. param name: value | type: string | description: String to look for at the end of the specified property value. Return type: REFERENCE Method: eq(field, value) Description: Refines a query to match items whose specified property value equals the specified value. The `eq()` method refines this query to only match items where Value of the specified property equals the specified `value`. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a number does not match the same number stored as a string. Matching strings with `eq()` is case sensitive, so `"text"` is not equal to `"Text"`. If `field` points to a collection field of type array, `eq()` includes the item as long as at least one array element matches the specified `value`. Method parameters: param name: field | type: string | description: Field whose value is compared with `value`. param name: value | type: any | description: Value to match. Return type: REFERENCE Method: fields(fields) Description: Lists the fields to return in a query's results. The `fields()` method returns only the specified fields in the query's results. You can use `include()` in conjunction with `fields()` to get referenced items. When `fields()` receives an empty or invalid property, the query behaves as follows: - When no fields are specified, the query returns all fields. - When multiple fields are specified but some are invalid, invalid fields are ignored and valid fields are returned. - When only invalid fields are specified, only the default `_id` field is returned. Method parameters: param name: fields | type: Array | description: Properties to return. Return type: REFERENCE Method: find(options) Description: Returns the items that match the query. The `find()` method returns a Promise that resolves to the results found by the query and some information about the results. The Promise is rejected if `find()` is called with incorrect permissions or if any of the methods used to refine the query is invalid. Calling the `find()` method triggers the [`beforeQuery()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-query.md) and [`afterQuery()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-query.md) hooks if they have been defined. > **Note:** > Calling `find()` triggers hooks for the specified collection only. It doesn't trigger hooks for referenced collections. Use the `options` parameter to override default preferences: - Ensure the most up-to-date data is retrieved with `consistentRead`. - Prevent hooks from running with `suppressHooks`. - Get a count of all the items that match the query by setting `returnTotalCount` to `true`. If you build a query and don't refine it with any `wixDataQuery` methods, `find()` returns the entire collection. Method parameters: param name: options | type: WixDataQueryOptions | description: Configuration options for building the query. Return type: PROMISE Method: ge(field, value) Description: Refines a query to match items whose specified property value is greater than or equal to the specified value. The `ge()` method refines this query to only match items where the value of the specified property is greater than or equal to the specified `value`. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a number does not match the same number stored as a string. If a property contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified property are ranked lowest. The following types of properties can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so `"abc"` is greater than or equal to `"ABC"` (because of the greater than), but `"ABC"` is not greater than or equal to `"abc"`. - Reference: Compares by the GUID of the referenced item as a String. Method parameters: param name: field | type: string | description: Field whose value is compared with `value`. param name: value | type: undefined | description: Value to match. Return type: REFERENCE Method: gt(field, value) Description: Refines a query to match items whose specified property value is greater than the specified value. The `gt()` method refines this query to only match items where the value of the specified property is greater than the specified `value`. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a number does not match the same number stored as a string. If a property contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified property are ranked lowest. The following types of properties can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so `"text"` is greater than `"Text"`. - Reference: Compares by the GUID of the referenced item as a String. Method parameters: param name: field | type: string | description: Field whose value is compared with `value`. param name: value | type: undefined | description: Value to match. Return type: REFERENCE Method: hasAll(field, values) Description: Refines a query to match items whose specified field values equals all of the specified values. The `hasAll()` method refines this query to only match items where the value of the specified field equals all of the specified values. Matching strings with `hasAll()` is case sensitive, so `"text"` is not considered equal to `"Text"`. If the value of the specified field is an array, `hasAll()` matches if all the specified values match all the elements of the array. You can specify a list of values to match by providing an array of strings, numbers, or dates. Method parameters: param name: field | type: string | description: Field whose value is compared with `value`. param name: values | type: undefined | description: Values to match. Return type: REFERENCE Method: hasSome(field, values) Description: Refines a query to match items where the value of the specified field equals any of the specified values. The `hasSome()` method refines this query to only match items where the value of the specified field equals any of the specified values. Matching strings with `hasSome()` is case sensitive, so `"text"` is not considered equal to `"Text"`. If the value of the specified field is an array, `hasSome()` matches if any of the elements of that array match any of the specified values. If the specified field contains multiple references, specify their item GUIDs. In such a case, `hasSome() matches if any of the references match any of the specified GUIDs. You can specify a list of values to match by providing an array of strings, numbers, or dates. @public @documentationMaturity preview @param field - Field whose value is compared with `value`. Method parameters: param name: field | type: string | description: none param name: values | type: undefined | description: Values to match. Return type: REFERENCE Method: include(fields) Description: Includes referenced items for the specified properties in a query's results. The `include()` method refines a query so that the items returned in the query's results include the full referenced items for the specified properties. For example, suppose you have a **books** collection with an **author** field that references an **authors** collection. Querying the **books** collection with an `include("author")` returns the relevant book items and each item will include the full referenced author item in the book's `author` property. When querying a collection that contains a reference field without using the `include()` method: - Single reference field: returned items contain only the GUID of the referenced item, and not the full referenced items. - Multiple reference field: returned items do not contain the multiple reference field at all. When including a property with multiple references, the following limitations apply: - Up to 100 properties with multiple references can be included. - By default, each returned item can include up to 50 referenced items. To change this limit, pass a numeric value as the final argument to `include()`. For example, `.include("publishers", 200)` returns a maximum of 200 publishers for every item. The limit applies to all multi-reference fields being included. For example, `.include("publishers", "authors", 200)` returns a maximum of 200 publishers and 200 authors for every item. The maximum value that can be set is `1000`. If no limit is provided, it defaults to `50`. To retrieve more referenced items, use [`queryReferenced()`](https://dev.wix.com/docs/sdk/business-solutions/data/items/query-referenced.md). For a discussion of when to use the similar `queryReferenced()` method and when to use `include()`, see [Querying Items that Reference Other Items](https://support.wix.com/en/article/including-referenced-data-when-filtering). > **Note:** The `include()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection). Method parameters: param name: fields | type: Array | description: Fields for which to include referenced items. Return type: REFERENCE Method: isEmpty(field) Description: Refines a query to match items whose specified property does not exist or does not have any value. The `isEmpty()` method refines this query to only match items where the value of the specified property is `null` or `undefined` or the property does not exist. If the property contains any value at all for a given item, including the empty string or an invalid value, that item will match the query. Method parameters: param name: field | type: string | description: Field to check for a value. Return type: REFERENCE Method: isNotEmpty(field) Description: Refines a query to match items whose specified property has any value. The `isNotEmpty()` method refines this query to only match items where the value of the specified property is not `null` or `undefined`. If the property contains any value at all for a given item, including the empty string or an invalid value, that item will match the query. Method parameters: param name: field | type: string | description: Field to check for a value. Return type: REFERENCE Method: le(field, value) Description: Refines a query to match items whose specified property value is less than or equal to the specified value. The `le()` method refines this query to only match items where the value of the specified property is less than or equal to the specified `value`. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a number does not match the same number stored as a string. If a property contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified property are ranked lowest. The following types of properties can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so `"ABC"` is less than or equal to `"abc"` (because of the less than), but `"abc"` is not less than or equal to `"ABC"`. - Reference: Compares by the GUID of the referenced item as a String. Method parameters: param name: field | type: string | description: Field whose value is compared with `value`. param name: value | type: undefined | description: Value to match. Return type: REFERENCE Method: limit(limitNumber) Description: Limits the number of items the query returns. The `limit()` method defines the number of results a query returns in each page. Only one page of results is retrieved at a time. The `next()` and `prev()` methods are used to navigate the pages of a query result. By default, `limit` is set to `50`. The maximum value that `limit()` can accept is `1000`. Note that for some [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md), the maximum value `limit()` can accept is less than `1000`. For example, the maximum limit for the Wix `Stores/Product` collection is 100. Method parameters: param name: limitNumber | type: number | description: Number of items to return, which is also the `pageSize` of the results object. Return type: REFERENCE Method: lt(field, value) Description: Refines a query to match items whose specified property value is less than the specified value. The `lt()` method refines this query to only match items where the value of the specified property is less than the specified `value`. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a number does not match the same number stored as a string. If a property contains a number as a string, that value is compared alphabetically and not numerically. Items that do not have a value for the specified property are ranked lowest. The following types of properties can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so `"Text"` is less than `"text"`. - Reference: Compares by the GUID of the referenced item as a String. Method parameters: param name: field | type: string | description: Field whose value is compared with `value`. param name: value | type: undefined | description: Value to match. Return type: REFERENCE Method: ne(field, value) Description: Refines a query to match items whose specified property value does not equal the specified value. The `ne()` method refines this query to only match items where the value of the specified property does not equal the specified `value`. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md). For example, a number value stored as a number is considered not equal to the same number stored as a string. Matching strings with `ne()` is case sensitive, so `"text"` is not equal to `"Text"`. If the value of the `field` property is an array, `ne()` includes items in which none of the elements of the array match the specified `value`. Method parameters: param name: field | type: string | description: Field whose value is compared with `value`. param name: value | type: any | description: Value to match. Return type: REFERENCE Method: not(filter) Description: Adds a `not` condition to the query or filter. The `not()` method adds a `not` condition to this query. A query with a `not` returns all the items that match the query as defined up to the `not` method, but don't match the filter passed to the `not` method. If the query only contains a `not()` method, it returns all the items that don't match the filter defined by the `not` method. Method parameters: param name: filter | type: WixDataFilter | description: Filter to add to the initial filter as a `not` condition. Return type: REFERENCE Method: or(filter) Description: Adds an `or` condition to the query or filter. The `or()` method adds an inclusive `or` condition to this filter. A query or filter with an `or` returns all the items that match the query or filter as defined up to the `or` method, the items that match the query or filter passed to the `or` method, and the items that match both. The `or()` method is designed to work with 2 or more queries or filters. Used on its own, it returns all the items in a collection. Method parameters: param name: filter | type: WixDataFilter | description: Filter to add to the initial filter as an `or` condition. Return type: REFERENCE Method: skip(skipCount) Description: Sets the number of items to skip before returning query results. The `skip()` method defines the number of results to skip in the query results before returning new query results. For example, if you query a collection and 50 items match your query, but you set `skip` to 10, the results returned will skip the first 10 items that match and return the 11th through 50th items. By default, `skip` is set to 0. Method parameters: param name: skipCount | type: number | description: Number of items to skip in the query results before returning the results. Return type: REFERENCE Method: startsWith(field, value) Description: Refines a query to match items whose specified property value starts with a specified value. The `startsWith()` method refines this query to only match items where the value of the specified field starts with the specified value. Matching with `startsWith()` is not case sensitive, so `"TEXT"` is considered to start with `"tex"`. You can only use `startsWith()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data.md) string or reference. When specifying a field of type reference, `startsWith()` matches by the GUID of the referenced item as a string. Method parameters: param name: field | type: string | description: Field whose value is compared with the specified value. param name: value | type: string | description: String to look for at the beginning of the specified property value. Return type: REFERENCE ```