Skip to content

Expand the aggregation pipeline with an expression compiler and new stage - #6

Open
DavidBadura wants to merge 3 commits into
1.1.xfrom
aggregation-stage-extensions
Open

DavidBadura wants to merge 3 commits into
1.1.xfrom
aggregation-stage-extensions

Conversation

@DavidBadura

Copy link
Copy Markdown
Member

This grows aggregation from a fixed handful of stages into most of the common MongoDB pipeline. The core piece is a new ExpressionBuilder that compiles Mongo aggregation expressions to SQL over the JSONB column. Everything else builds on it.

$group now takes a multi-key _id, groups by and accumulates over arbitrary expressions, and adds $push, $addToSet and $count. $unwind gained the object form (preserveNullAndEmptyArrays, includeArrayIndex) and treats a scalar as a single-element array like Mongo. $project can rename fields and compute new ones, and $match (plus plain find()) understands $expr.

New stages: $addFields/$set, $unset, $replaceRoot/$replaceWith, $count, $sortByCount.

@DavidBadura DavidBadura added this to the 1.1.0 milestone Aug 29, 2026
@DavidBadura DavidBadura added the enhancement New feature or request label Aug 29, 2026
@DavidBadura DavidBadura removed this from the 1.1.0 milestone Aug 31, 2026
private PDO $pdo,
private FilterBuilder $filterBuilder,
private ProjectionBuilder $projectionBuilder,
private ExpressionBuilder $expressionBuilder,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BC-Break -> needs to be optional?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants