Skip to content

Commit

Permalink
mongodb: aggregation style improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
imedina committed Dec 13, 2024
1 parent a7c86e0 commit eb5b519
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ private static Facet getMongoDBFacet(String groupField, Accumulator accumulator,
switch (accumulator) {
case count: {
facet = new Facet(groupField + COUNTS_SUFFIX,
Aggregates.group("$" + groupField, Accumulators.sum(count.name(), accumulatorId)));
Aggregates.group("$" + groupField, Accumulators.sum(accumulator.name(), accumulatorId)));
// facet = new Facet(field + COUNTS_SUFFIX,
// Arrays.asList(Aggregates.group(
// id,
Expand All @@ -814,13 +814,13 @@ private static Facet getMongoDBFacet(String groupField, Accumulator accumulator,
break;
}
case stdDevPop: {
facet = new Facet(groupField + STD_DEV_POP_SUFFIX, Arrays.asList(Aggregates.group(groupField,
Accumulators.stdDevPop(stdDevPop.name(), accumulatorId))));
facet = new Facet(groupField + STD_DEV_POP_SUFFIX,
Aggregates.group(groupField, Accumulators.stdDevPop(stdDevPop.name(), accumulatorId)));
break;
}
case stdDevSamp: {
facet = new Facet(groupField + STD_DEV_SAMP_SUFFIX, Arrays.asList(Aggregates.group(groupField,
Accumulators.stdDevSamp(stdDevSamp.name(), accumulatorId))));
facet = new Facet(groupField + STD_DEV_SAMP_SUFFIX,
Aggregates.group(groupField, Accumulators.stdDevSamp(stdDevSamp.name(), accumulatorId)));
break;
}
case bucket: {
Expand Down

0 comments on commit eb5b519

Please sign in to comment.