Skip to content

Commit

Permalink
mongodb: aggregation test 3. To be reverted.
Browse files Browse the repository at this point in the history
  • Loading branch information
imedina committed Dec 13, 2024
1 parent 57f2138 commit 3cca26f
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -781,15 +781,13 @@ private static Facet getMongoDBFacet(String field, Accumulator accumulator, List
Facet facet;
switch (accumulator) {
case count: {
// facet = new Facet(field + COUNTS_SUFFIX, Arrays.asList(Aggregates.group(id, Accumulators.sum(count.name(), 1))));
facet = new Facet(field + COUNTS_SUFFIX,
Arrays.asList(Aggregates.group(
id,
Accumulators.sum(count.name(), 1),
Accumulators.sum("size", "$size"),
Accumulators.avg("avg", "$size")
)));
break;
facet = new Facet(field + COUNTS_SUFFIX, Arrays.asList(Aggregates.group(id, Accumulators.sum(count.name(), "$size"))));
// facet = new Facet(field + COUNTS_SUFFIX,
// Arrays.asList(Aggregates.group(
// id,
// Accumulators.sum("size", "$size")
// )));
// break;
}
case sum: {
facet = new Facet(field + SUM_SUFFIX, Arrays.asList(Aggregates.group(field, Accumulators.sum(sum.name(), id))));
Expand Down

0 comments on commit 3cca26f

Please sign in to comment.