Defined in: packages/db/src/query/builder/group-keys.ts:9
Group keys for query.groupBy(...) when the query has no aggregate. Aggregates such as count bring the grouping compiler themselves.
TContext extends Context
callback: GroupByCallback<TContext>;Defined in: packages/db/src/query/builder/group-keys.ts:10
grouping: object;Defined in: packages/db/src/query/builder/group-keys.ts:11
processGroupBy: (pipeline, groupByClause, valueIdentity, isSourceRef, havingClauses?, selectClause?, fnHavingClauses?, aggregateCollectionId?, mainSource?, sanitizeCallbackRows) => NamespacedAndKeyedStream;Processes the GROUP BY clause with optional HAVING and SELECT Works with the new $selected structure from early SELECT processing
ValueIdentity
(ref) => boolean
Whether a ref reads a field of the query's own rows.
Where[]
(row) => any[]
string
string
boolean = false
replaceAggregatesByRefs: (havingExpr, selectClause, resultAlias) => BasicExpression;Transforms expressions to replace aggregate functions with references to computed values.
For aggregate expressions, finds matching aggregates in the SELECT clause and replaces them with PropRef([resultAlias, alias]) to reference the computed aggregate value.
Ref expressions (table columns and $selected fields) and value expressions are passed through unchanged. Function expressions are recursively transformed.
The expression to transform (can be aggregate, ref, func, or val)
Aggregate<any> | BasicExpression
The SELECT clause containing aliases and aggregate definitions
string = ...
The namespace alias for SELECT results (default: '$selected')
A transformed BasicExpression that references computed values instead of raw expressions