From 3cca26fe25cd3e00d28baa23ecef3fea4782d001 Mon Sep 17 00:00:00 2001 From: imedina Date: Fri, 13 Dec 2024 11:29:16 +0000 Subject: [PATCH] mongodb: aggregation test 3. To be reverted. --- .../datastore/mongodb/MongoDBQueryUtils.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java b/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java index fbb529e0..1d3e50f7 100644 --- a/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java +++ b/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java @@ -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))));