Refines a WixDataAggregate
to contain the item count of each group in the aggregation.
The count()
function refines a WixDataAggregate
to contain 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:
"count"
.Note: Aggregations can only be used on collections you have created. They cannot be used on Wix App Collections.
function count(): WixDataAggregate;
let newAggregate = aggregate.count();
Adds a sort to an aggregation, sorting by the items or groups by the specified properties in descending order.
The descending()
function refines a WixDataAggregate
to sort the resulting
items or groups in descending order. 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:
"abc"
comes after "XYZ"
.If a property contains a number as a String, that value will be sorted alphabetically and not numerically. Items that do not have a value for the specified sort property are ranked lowest.
Note: Aggregations can only be used on collections you have created. They cannot be used on Wix App Collections.
The properties used in the sort.
Filters out items from being used in an aggregation.
The filter()
function 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()
function.
Filtering using filter()
takes place before grouping is performed on the
aggregation. To filter grouped results, use the having()
function.
Note: Aggregations can only be used on collections you have created. They cannot be used on Wix App Collections.
The filter to use to filter out items from being used in the aggregation.