min( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

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 ID 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.

Method Declaration
Copy
Method Parameters
fieldstringRequired

Field in which to find the minimum value.


projectedFieldstring

Name of the field in the aggregation results containing the minimum value.

Returns
Return Type:WixDataAggregate
Did this help?