From eb5b519d697f06117c83272382f35a2ffed39ca0 Mon Sep 17 00:00:00 2001 From: imedina Date: Fri, 13 Dec 2024 12:02:24 +0000 Subject: [PATCH] mongodb: aggregation style improvement --- .../commons/datastore/mongodb/MongoDBQueryUtils.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 1ad7b7bc..a7ad9b80 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 @@ -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, @@ -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: {