Aggregate an Array of Objects Across Multiple Fields with Custom Reducers (Part 2)
Extend the Part 1 aggregation to support custom aggregator functions per field — not just sum/count, but also min, max, average, distinct count, and first/last value collectors. Accept a configuration object specifying which field to aggregate, which function to apply, and what to name the output key. This mirrors SQL window functions and is the engine behind pivot tables and analytics dashboards in frontend reporting tools.