> 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: WixDataAggregate # Action: count # Link: https://dev.wix.com/docs/sdk/business-solutions/data/items/wix-data-aggregate/count.md ## Description: Refines a `WixDataAggregate` to contain the item count of each group in the aggregation. The `count()` method refines a `WixDataAggregate` contains the item count in each of the aggregate's groups. When the aggregation is `run()`, the returned `WixDataAggregateResult` object contains items with the following additional key-value pair: - The key is named `count`. You can set a custom key using the `projectedField` parameter. - The value is the count of items aggregated in the group. > **Note:** Aggregations can only be used on collections you have created. They cannot be > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). ## Schema: ```json Method: count(projectedField) Description: Refines a `WixDataAggregate` to contain the item count of each group in the aggregation. The `count()` method refines a `WixDataAggregate` contains the item count in each of the aggregate's groups. When the aggregation is `run()`, the returned `WixDataAggregateResult` object contains items with the following additional key-value pair: - The key is named `count`. You can set a custom key using the `projectedField` parameter. - The value is the count of items aggregated in the group. > **Note:** Aggregations can only be used on collections you have created. They cannot be > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). Method parameters: param name: projectedField | type: string | description: Field in the aggregation results that contains the count value. Default: `count`. Return type: REFERENCE Method: ascending(fields) Description: Adds a sort to a query or sort, sorting by the specified fields in ascending order. The `ascending()` method refines this query in ascending order of the specified fields. 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 after `"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. > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections). Method parameters: param name: fields | type: Array | description: Fields to sort by. Return type: REFERENCE Method: avg(field, projectedField) Description: Refines a `WixDataAggregate` to only contain the average value from each aggregation group. The `avg()` method refines a `WixDataAggregate` to contain the average value from the specified field for each aggregated group or from the whole collection if no group is defined. When the aggregation is `run()`, the returned `WixDataAggregateResult` object contains an item for each group with the following key-value pairs: - If a value was passed for the optional `projectedField`, the key is named using that value. Otherwise, the key is named using the following format: `"fieldAvg"`, where `field` is the name of the specified field. - The value is the average of the values found in the specified field. Averages can only be calculated on fields of type Number. > **Note:** Aggregations can only be used on collections you have created. They cannot be > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). Method parameters: param name: field | type: string | description: Field in which to find the average value. param name: projectedField | type: string | description: Field in the aggregation results containing the average value. Return type: REFERENCE Method: count(projectedField) Description: Refines a `WixDataAggregate` to contain the item count of each group in the aggregation. The `count()` method refines a `WixDataAggregate` contains the item count in each of the aggregate's groups. When the aggregation is `run()`, the returned `WixDataAggregateResult` object contains items with the following additional key-value pair: - The key is named `count`. You can set a custom key using the `projectedField` parameter. - The value is the count of items aggregated in the group. > **Note:** Aggregations can only be used on collections you have created. They cannot be > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). Method parameters: param name: projectedField | type: string | description: Field in the aggregation results that contains the count value. Default: `count`. Return type: REFERENCE Method: descending(fields) Description: Adds a sort to a query or sort, sorting by the specified fields in descending order. The `descending()` method refines this query to sort in descending order of the specified fields. 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. > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections). Method parameters: param name: fields | type: Array | description: Fields to sort by. Return type: REFERENCE Method: filter(filter) Description: Filters out items from being used in an aggregation. The `filter()` method refines a `WixDataAggregate` so that it only includes items from the aggregate's collection which match the specified filter criteria. To create a filter, use the wix-data `filter()` method. Filtering using `filter()` takes place before grouping is performed on the aggregation. To filter grouped results, use the `having()` method. > **Note:** Aggregations can only be used on collections you have created. They cannot be > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). Method parameters: param name: filter | type: WixDataFilter | description: Filter to use to filter out items from being used in the aggregation. 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: group(field) Description: Groups items together in an aggregation. The `group()` method refines a `WixDataAggregate` so that its items are grouped by the specified field or fields. You can perform aggregations on the groups using the following methods: - `avg()` - `count()` - `max()` - `min()` - `sum()` To filter grouped results, use the `having()` method. > **Notes:** > - Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). > - You can only call the `group()` method once per aggregate query. Method parameters: param name: field | type: Array | description: Field or fields to group on. Return type: REFERENCE Method: having(filter) Description: Filters out groups from being returned from an aggregation. The `having()` method refines a `WixDataAggregate` so that it only includes groups from the aggregate's grouping which match the specified filter criteria. To create a filter, use the wix-data `filter()` method. Filtering using `having()` takes place after grouping is performed on the aggregation. To filter items before grouping, use the `filter()` method. > **Note:** Aggregations can only be used on collections you have created. They cannot be used in [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). Method parameters: param name: filter | type: WixDataFilter | description: Filter to use to filter out groups from being returned from the aggregation. Return type: REFERENCE Method: limit(limit) Description: Limits the number of items or groups the aggregation returns. The `limit()` method defines the number of results an aggregation returns in each page. Only one page of results is retrieved at a time. The `next()` method is 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:** Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). Method parameters: param name: limit | type: number | description: Number of items or groups to return. Return type: REFERENCE Method: max(field, projectedField) Description: Refines a `WixDataAggregate` to only contain the maximum value from each aggregation group. The `max()` method refines a `WixDataAggregate` to contain the maximum value from the specified field for each aggregated group or from the whole collection if no group is defined. When the aggregation is `run()`, the returned `WixDataAggregateResult` object contains an item for each group with the following key-value pairs: - If a value was passed for the optional `projectedField`, the key is named using that value. Otherwise, the key is named using the following format: `"fieldMax"`, where `field` is the name of the specified field. - The value is the maximum value found in the specified field. The following types of fields can be compared to determine a maximum value: - Number: Compares numerically. - Date and Time: Compares JavaScript Date objects. - Text: Compares lexicographically, so `"text"` is greater than `"Text"`. - Rich Text: Compares HTML source as text. - URL: Compares as text. - Image: Compares image source as text. - Video: Compares video source as text. - Document: Compares document source as text. - Reference: Compares by the GUID of the referenced item as a String. > **Note:** Aggregations can only be used on collections you have created. They cannot be > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). Method parameters: param name: field | type: string | description: Field in which to find the maximum value. param name: projectedField | type: string | description: Field in the aggregation results that contains the maximum value. Return type: REFERENCE Method: min(field, projectedField) Description: Refines a `WixDataAggregate` to only contain the minimum value from each aggregation group. The `min()` method refines a `WixDataAggregate` to contain the minimum value from the specified field for each aggregated group or from the whole collection if no group is defined. When the aggregation is `run()`, the returned `WixDataAggregateResult` object contains an item for each group with the following key-value pairs: - If a value was passed for the optional `projectedField`, the key is named using that value. Otherwise, the key is named using the following format: `"fieldMin"`, where `field` is the name of the specified field. - The value is the minimum value found in the specified field. The following types of fields can be compared to determine a minimum value: - Number: Compares numerically. - Date and Time: Compares JavaScript Date objects. - Text: Compares lexicographically, so `"text"` is greater than `"Text"`. - Rich Text: Compares HTML source as text. - URL: Compares as text. - Image: Compares image source as text. - Video: Compares video source as text. - Document: Compares document source as text. - Reference: Compares by the GUID of the referenced item as a String. > **Note:** Aggregations can only be used on collections you have created. They cannot be > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). Method parameters: param name: field | type: string | description: Field in which to find the minimum value. param name: projectedField | type: string | description: Name of the field in the aggregation results containing the minimum value. Return type: REFERENCE Method: run(options) Description: Runs the aggregation and returns the results. The `run()` method returns a Promise that resolves to the results found by the aggregation and some information about the results. > **Note:** Aggregations can only be used on collections you have created. They cannot be > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). Method parameters: param name: options | type: WixDataAggregateOptions | description: Options to use when running an aggregation. - 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: skip(skip) Description: Sets the number of items or groups to skip before returning aggregation results. The `skip()` method defines the number of results to skip in the aggregation results before returning new aggregation results. For example, if you perform an aggregation on a collection and 10 groups match your aggregation, but you set `skip` to 3, the results returned will skip the first 3 groups that match and return the 4th through 10th items. By default, `skip` is set to 0. > **Note:** Aggregations can only be used on collections you have created. They cannot be > used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections). Method parameters: param name: skip | type: number | description: Number of items or groups to skip in the aggregation results before returning the results. Return type: REFERENCE Method: sum(field, projectedField) Description: Refines a `WixDataAggregate` to contain the sum from each aggregation group. The `sum()` method refines a `WixDataAggregate` to contain the sum of the values from the specified field for each aggregated group or from the whole collection if no group is defined. When the aggregation is `run()`, the returned `WixDataAggregateResult` object contains an item for each group with the following key-value pairs: - If a value was passed for the optional `projectedField`, the key is named using that value. Otherwise, the key is named using the following format: `"fieldSum"`, where `field` is the name of the specified field. - The value is the sum of the values found in the specified field. Sums can only be calculated on fields of type Number. > **Note:** Aggregations can only be used on collections you have created. They cannot be > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md). Method parameters: param name: field | type: string | description: Field in which to find the sum. param name: projectedField | type: string | description: Name of the field in the aggregation results containing the sum. Return type: REFERENCE ```