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 203fc19b..b8a0003c 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 @@ -800,10 +800,8 @@ private static Facet getMongoDBFacet(String groupField, Accumulator accumulator, Facet facet; switch (accumulator) { case count: { - if (StringUtils.isEmpty(facetName)) { - facetName = groupField + SEPARATOR + COUNTS_SUFFIX; - } - facet = new Facet(facetName, Aggregates.group("$" + groupFieldId, Accumulators.sum(count.name(), 1))); + facetName = groupField + SEPARATOR + COUNTS_SUFFIX; + facet = new Facet(facetName, Aggregates.group("$" + groupField, Accumulators.sum(count.name(), 1))); break; } case sum: {