Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support _id aggregation operators for $group stage #3096

Merged
merged 19 commits into from
Jul 26, 2023
Prev Previous commit
Next Next commit
lint
  • Loading branch information
noisersup committed Jul 21, 2023
commit 1626f3fc0f7e1a86175469d3bc18cf771983b411
8 changes: 4 additions & 4 deletions internal/handlers/common/aggregations/stages/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ func (g *group) groupDocuments(ctx context.Context, in []*types.Document) ([]gro

return group.docs, nil

case *types.Array, float64, types.Binary, types.ObjectID, bool, time.Time, types.NullType,
chilagrow marked this conversation as resolved.
Show resolved Hide resolved
types.Regex, int32, types.Timestamp, int64:
// non-string or document key aggregates values of all `in` documents into one aggregated document.

case string:
expression, err := aggregations.NewExpression(groupKey)
if err != nil {
Expand Down Expand Up @@ -255,10 +259,6 @@ func (g *group) groupDocuments(ctx context.Context, in []*types.Document) ([]gro

return group.docs, nil

case *types.Array, float64, types.Binary, types.ObjectID, bool, time.Time, types.NullType,
types.Regex, int32, types.Timestamp, int64:
// non-string or document key aggregates values of all `in` documents into one aggregated document.

default:
panic(fmt.Sprintf("unexpected type %[1]T (%#[1]v)", groupKey))
}
Expand Down