> 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: WixDataSearch # Action: lt # Link: https://dev.wix.com/docs/sdk/business-solutions/data/items/wix-data-search/lt.md ## Description: Refines a search to match items where the value of the specified field is less than the specified value. The `lt()` method refines the search 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 number does not match the same number stored as a string. 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 types of fields can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so `"Text"` is less than `"text"`. - Reference: Compares by the ID of the referenced item as a String. ## Schema: ```json Method: lt(field, value) Description: Refines a search to match items where the value of the specified field is less than the specified value. The `lt()` method refines the search 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 number does not match the same number stored as a string. 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 types of fields 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 compare with. Return type: REFERENCE Method: and(filter) Description: Adds an `and` condition to the search filter. The `and()` method adds an `and` condition to the search filter. A search with an `and` returns all the items that match both the filter as defined up to the `and()` method, and the filter passed to the `and()` method. When chaining multiple filter methods to a search, an `and` condition is often assumed by default. For example, the search returns results whose status is active **and** age is greater than 25: ```javascript items .search("myCollection") .expression("some text") .eq("status", "active") .gt("age", 25); ``` The `and()` method is needed when using compound filters. For example, the final search in this set of operations returns results whose status is either pending or rejected **and** age is either less than 25 or greater than 65: ```javascript 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 finalSearch = items .search("myCollection") .expression("some text") .and(statusFilter) .and(ageFilter); ``` > **Note**: Calling `and()` without a filter may lead to unexpected results. Method parameters: param name: filter | type: WixDataFilter | description: Filter to add to the initial search filter 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: andMode() Description: Sets the search mode to **AND**. When in **AND** mode, an item must include all specified search terms to be included in the results. For example, the search expression "red car" in **AND** mode only retrieves items that include both "red" and "car". Return type: REFERENCE Method: ascending(fields) Description: Sorts search results in ascending order by the specified fields. The `ascending()` method refines the search to sort results by the specified fields in ascending order. If you specify more than one field, `ascending()` sorts the results in ascending order by each field 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 field 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 field are ranked lowest. Method parameters: param name: fields | type: Array | description: Fields by which to sort results in ascending order. Return type: REFERENCE Method: between(field, rangeStart, rangeEnd) Description: Refines a search to match items where the value of the specified field is within a specified range. The `between()` method refines the search to only match items where the value of the specified field 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 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 types of fields 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 (inclusive). param name: rangeEnd | type: undefined | description: Ending value of the range to match (exclusive). Return type: REFERENCE Method: descending(fields) Description: Sorts search results by the specified fields in descending order. The `descending()` method refines the search to sort results by the specified fields in descending order. If you specify more than one field, `descending()` sorts the results in descending order by each field 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 field 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 field are ranked lowest. Method parameters: param name: fields | type: Array | description: Fields by which to sort results in descending order. Return type: REFERENCE Method: eq(field, value) Description: Refines a search to match items where the value of the specified field equals the specified value. The `eq()` method refines the search to only match items where the value of the specified field 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 considered equal to `"Text"`. If the field contains an array, `eq()` matches the item if at least one array element equals 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: expression(queryText) Description: Specifies the text to search in the collection. The `expression()` method sets the search query. Search terms are separated by whitespace. For example, the expression `red car white roof` includes four search terms: `red`, `car`, `white`, and `roof`. Use [`andMode()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/and-mode.md) to require all terms to be present, or [`orMode()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/or-mode.md) to require at least one term to be present. Method parameters: param name: queryText | type: string | description: Text to search in the collection. Return type: REFERENCE Method: fields(fields) Description: Lists the fields to return in the search results. The `fields()` method specifies which fields to return in the search results. You can use `include()` together with `fields()` to get referenced items. When `fields()` receives an empty or an invalid field, the search behaves as follows: - When no fields are specified, the search 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: Fields to return. Return type: REFERENCE Method: fuzzy() Description: Enables fuzzy search for approximate text matching. The `fuzzy()` method enables fuzzy search. This allows for approximate matches that closely resemble the search expression even if they don't exactly match. Return type: REFERENCE Method: ge(field, value) Description: Refines a search to match items where the value of the specified field is greater than or equal to the specified value. The `ge()` method refines the search 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 number does not match the same number stored as a string. 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 types of fields can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so `"abc"` is greater than or equal to `"ABC"`, 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 compare against. Return type: REFERENCE Method: gt(field, value) Description: Refines a search to match items where the value of the specified field is greater than the specified value. The `gt()` method refines the search 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 number does not match the same number stored as a string. 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 types of fields 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 compare against. Return type: REFERENCE Method: hasAll(field, values) Description: Refines a search to match items where the value of the specified field equals all of the specified values. The `hasAll()` method refines the search 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 equal to `"Text"`. If the value of the specified field is an array, `hasAll()` matches 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 `values` 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. All specified values must be present. Return type: REFERENCE Method: hasSome(field, values) Description: Refines a search to match items where the value of the specified field equals any of the specified values. The `hasSome()` method refines the search 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 specified field contains an array, `hasSome()` matches items where any of the array's elements match any of the specified values. If the specified field contains multiple references, pass item GUIDs as the values. `hasSome()` matches if any of the references match any of the specified GUID values. You can specify multiple 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 the specified values. param name: values | type: undefined | description: Values to match. Return type: REFERENCE Method: include(fields) Description: Includes referenced items for the specified fields. The `include()` method refines a search so that the items returned in the search results include the full referenced items for the specified fields. For example, suppose you have a **books** collection with an **author** field that references an **authors** collection. Searching the **books** collection with an `include("author")` returns the relevant book items, and each item includes the full referenced author item in the book's `author` field. When searching 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 field with multiple references, the following limitations apply: - Only one field with multiple references can be included. - The search returns an error if more than 50 items are returned, regardless of any search limit set using the `limit()` method. - Each returned item can include up to 50 referenced items. If there are more than 50 referenced items, only 50 are returned, and the `partialIncludes` field of the returned `WixDataResult` is `true`. > **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 search to match items whose specified field does not exist or does not have any value (is null or undefined). The `isEmpty()` method refines the search to only match items where the specified field does not exist or where its value is `null` or `undefined`. If the field contains any value at all for a given item, including an empty string or an invalid value, that item does not match the search filter. Method parameters: param name: field | type: string | description: Field to check for an empty or non-existent value. Return type: REFERENCE Method: isNotEmpty(field) Description: Refines a search to match items whose specified field has a value that isn't `null` or `undefined`. The `isNotEmpty()` method refines the search 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 an empty string or an invalid value, that item matches the search filter. Method parameters: param name: field | type: string | description: Field to check for a non-empty value. Return type: REFERENCE Method: le(field, value) Description: Refines a search to match items where the value of the specified field is less than or equal to the specified value. The `le()` method refines the search 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 number does not match the same number stored as a string. 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 types of fields can be compared: - Number: Compares numerically. - Date: Compares JavaScript Date objects. - String: Compares lexicographically, so `"ABC"` is less than or equal to `"abc"`, 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 compare with. Return type: REFERENCE Method: limit(limitNumber) Description: Limits the number of items the search returns. The `limit()` method defines the number of results a search operation returns in each page. Only one page of results is retrieved at a time. The `next()` and `prev()` methods of the [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction.md) object are used to navigate the pages of a search result. By default, `limit` is set to `100`. The maximum value that `limit()` can accept is `1000`. 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 search to match items where the value of the specified field is less than the specified value. The `lt()` method refines the search 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 number does not match the same number stored as a string. 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 types of fields 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 compare with. Return type: REFERENCE Method: ne(field, value) Description: Refines a search to match items where the value of the specified field does not equal the specified value. The `ne()` method refines the search 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 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 `field` 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 not match. Return type: REFERENCE Method: not(filter) Description: Adds a `not` condition to the search filter. The `not()` method adds a `not` condition to the search filter. A search with a `not` returns all the items that match the filter as defined up to the `not()` method and don't match the filter passed to the `not()` method. If the search filter only contains a `not()` method, it returns all the items that don't match the filter specified to the 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 search filter. The `or()` method adds an inclusive `or` condition to the search filter. The search 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. > **Note**: Calling `or()` without a filter may lead to unexpected results. Method parameters: param name: filter | type: WixDataFilter | description: Filter to add to the initial filter as an `or` condition. Return type: REFERENCE Method: orMode() Description: Sets the search mode to **OR**. When in **OR** mode, an item must include at least one of the specified search terms to be included in the results. For example, the search expression "red car" in **OR** mode retrieves items that include "red", "car", or both. Return type: REFERENCE Method: run(options) Description: Runs the search operation. The `run()` method searches the collection for the specified expression. It returns a Promise that resolves to a [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction.md) that contains the matching items and search metadata. Search operations are [eventually consistent](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency.md) and might not reflect recent changes. Method parameters: param name: options | type: WixDataReadOptions | description: Options for building the search 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 - 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: skip(skipCount) Description: Sets the number of items to skip before returning search results. The `skip()` method defines the number of results to skip in the search results before returning new search results. For example, if your search matches 50 items, but you set `skip` to 10, the results returned skips 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 before returning the results. Return type: REFERENCE Method: startsWith(field, value) Description: Refines a search to match items where the value of the specified field starts with a specified value. The `startsWith()` method refines the search to only match items where the value of the specified field starts with the specified value. Matching with `startsWith()` is case-sensitive, so searching for `"Sun"` does not match an item that contains the text `"sunshine"`. You can only use `startsWith()` with a field whose value is a String or Reference. When using a 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 `value` parameter. param name: value | type: string | description: String to look for at the beginning of the specified field value. Return type: REFERENCE ```