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 recursive operator calls for $sum aggregation accumulator #3116

Merged
merged 18 commits into from
Jul 31, 2023
Prev Previous commit
Next Next commit
wip
  • Loading branch information
noisersup committed Jul 27, 2023
commit de3d1095cad71229e14dbb99ad6556805584a931
11 changes: 11 additions & 0 deletions integration/aggregate_documents_compat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,17 @@ func TestAggregateCompatGroupSum(t *testing.T) {
bson.D{{"$sort", bson.D{{"_id", -1}}}},
},
},
//"RecursiveOperatorError": {
// pipeline: bson.A{
// bson.D{{"$sort", bson.D{{"_id", 1}}}},
// bson.D{{"$group", bson.D{
// {"_id", "$_id"},
// // first $sum is accumulator operator, second $sum is operator
// {"sum", bson.D{{"$sum", bson.D{{"$sum", "$v"}}}}},
// }}},
// bson.D{{"$sort", bson.D{{"_id", -1}}}},
// },
//},
}

testAggregateStagesCompatWithProviders(t, providers, testCases)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func newSum(accumulation *types.Document) (Accumulator, error) {
)
case *types.Document:
if !operators.IsOperator(expr) {
//TODO
accumulator.number = int32(0)
break
}
Expand Down