Stage Category: REDUCE (Aggregates results)Transformation: N documents → aggregation results + optional documents
Aggregating a whole collection? The collection-level endpoint
POST /v1/collections/{collection_id}/aggregate runs the same functions over
every matching document (not just the current pipeline’s results) and returns
exact counts at any collection size — count, count_distinct, sum,
avg, min, and max stream without a row cap. Pair it with the is_null
filter operator for field-presence / data-validity checks, e.g. count how many
documents are missing an ancestor (from_collection) field across 180k+ assets.
