← Changelog
NewApps

Aggregate queries: counts, sums and averages in groups

api.<model>.aggregate answers questions like reviews per product per month or revenue by status without reading every record. Name each aggregate (count, sum, avg, min, max), group by up to four fields or by hour, day, week, month, quarter or year in a time zone, and filter and search as in findMany. Calls held to a store or role count only what they can read. It's on the REST API, the MCP server, and app pages through useAggregate; a global action that returns one makes a report the app calls by name.

More in Aggregates.