Skip to main content

Aggregate Records

This node performs database aggregations like Count, Sum, Min, Max, and Average.

The Aggregate Records node runs calculations on a collection of records on the server.

The Aggregate Records node allows you to compute statistics on your data without fetching all records to the client. It is efficient for dashboards and reports.

Inputs

General

DataDescription
ClassThe database collection to aggregate.
FilterOptional. A filter to select which records to include (same format as Filter Records).

Aggregation

DataDescription
FieldThe field to aggregate on (e.g., "price").
Operation"Count", "Sum", "Min", "Max", "Average".
Group ByOptional. Field to group results by (e.g., "category").

Actions

SignalDescription
DoTriggers the aggregation.

Outputs

Results

DataDescription
ResultThe calculated value (number).
Grouped ResultsIf "Group By" is used, an array of objects .

Events

SignalDescription
DoneTriggered when complete.

Usage

Total Sales

  1. Class: "Orders".
  2. Field: "total".
  3. Operation: "Sum".
  4. Trigger Do.
  5. Result output will be the sum of all order totals.

Sales by Category

  1. Group By: "category".
  2. Grouped Results will contain .

Detailed Behavior

  • Server-Side: The calculation happens in the database engine, minimizing data transfer.

Troubleshooting

  • Zero Result: Ensure the field type is Number. Summing strings usually results in 0 or an error.