From dbfd4e5c624a9770a2ee6d3235b1e22a604583c7 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Thu, 22 Jul 2021 11:44:15 +0200 Subject: [PATCH] Polishing. Reformat code. See #3712 Original pull request: #3740. --- .../core/aggregation/AccumulatorOperators.java | 16 ++++++++-------- .../AccumulatorOperatorsUnitTests.java | 2 ++ src/main/asciidoc/reference/mongodb.adoc | 8 ++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperators.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperators.java index 1ea1af973..13913caac 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperators.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperators.java @@ -143,8 +143,8 @@ public class AccumulatorOperators { } /** - * Creates new {@link AggregationExpression} that uses the previous input (field/expression) and the value of the given - * field to calculate the population covariance of the two. + * Creates new {@link AggregationExpression} that uses the previous input (field/expression) and the value of the + * given field to calculate the population covariance of the two. * * @param fieldReference must not be {@literal null}. * @return new instance of {@link CovariancePop}. @@ -155,8 +155,8 @@ public class AccumulatorOperators { } /** - * Creates new {@link AggregationExpression} that uses the previous input (field/expression) and the result of the given - * {@link AggregationExpression expression} to calculate the population covariance of the two. + * Creates new {@link AggregationExpression} that uses the previous input (field/expression) and the result of the + * given {@link AggregationExpression expression} to calculate the population covariance of the two. * * @param expression must not be {@literal null}. * @return new instance of {@link CovariancePop}. @@ -171,8 +171,8 @@ public class AccumulatorOperators { } /** - * Creates new {@link AggregationExpression} that uses the previous input (field/expression) and the value of the given - * field to calculate the sample covariance of the two. + * Creates new {@link AggregationExpression} that uses the previous input (field/expression) and the value of the + * given field to calculate the sample covariance of the two. * * @param fieldReference must not be {@literal null}. * @return new instance of {@link CovariancePop}. @@ -183,8 +183,8 @@ public class AccumulatorOperators { } /** - * Creates new {@link AggregationExpression} that uses the previous input (field/expression) and the result of the given - * {@link AggregationExpression expression} to calculate the sample covariance of the two. + * Creates new {@link AggregationExpression} that uses the previous input (field/expression) and the result of the + * given {@link AggregationExpression expression} to calculate the sample covariance of the two. * * @param expression must not be {@literal null}. * @return new instance of {@link CovariancePop}. diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperatorsUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperatorsUnitTests.java index 977183c44..6948255d1 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperatorsUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperatorsUnitTests.java @@ -27,6 +27,8 @@ import org.springframework.data.mongodb.core.mapping.Field; import org.springframework.data.mongodb.util.aggregation.TestAggregationContext; /** + * Unit tests for {@link AccumulatorOperators}. + * * @author Christoph Strobl */ class AccumulatorOperatorsUnitTests { diff --git a/src/main/asciidoc/reference/mongodb.adoc b/src/main/asciidoc/reference/mongodb.adoc index 84afc7ea0..3bfa50073 100644 --- a/src/main/asciidoc/reference/mongodb.adoc +++ b/src/main/asciidoc/reference/mongodb.adoc @@ -1002,7 +1002,7 @@ assertThat(upserted.getFirstName()).isEqualTo("Mary"); assertThat(upserted.getAge()).isOne(); ---- -[[mongo-template.aggregation-update]] += [[mongo-template.aggregation-update]] === Aggregation Pipeline Updates Update methods exposed by `MongoOperations` and `ReactiveMongoOperations` also accept an <> via `AggregationUpdate`. @@ -2502,8 +2502,8 @@ At the time of this writing, we provide support for the following Aggregation Op | Set Aggregation Operators | `setEquals`, `setIntersection`, `setUnion`, `setDifference`, `setIsSubset`, `anyElementTrue`, `allElementsTrue` -| Group Aggregation Operators -| `addToSet`, `first`, `last`, `max`, `min`, `avg`, `push`, `sum`, `(*count)`, `stdDevPop`, `stdDevSamp` +| Group/Accumulator Aggregation Operators +| `addToSet`, `covariancePop`, `covarianceSamp`, `first`, `last`, `max`, `min`, `avg`, `push`, `sum`, `(*count)`, `stdDevPop`, `stdDevSamp` | Arithmetic Aggregation Operators | `abs`, `add` (*via `plus`), `ceil`, `divide`, `exp`, `floor`, `ln`, `log`, `log10`, `mod`, `multiply`, `pow`, `round`, `sqrt`, `subtract` (*via `minus`), `trunc` @@ -2544,7 +2544,7 @@ At the time of this writing, we provide support for the following Aggregation Op * The operation is mapped or added by Spring Data MongoDB. -Note that the aggregation operations not listed here are currently not supported by Spring Data MongoDB. Comparison aggregation operators are expressed as `Criteria` expressions. +Note that the aggregation operations not listed here are currently not supported by Spring Data MongoDB.Comparison aggregation operators are expressed as `Criteria` expressions. [[mongo.aggregation.projection]] === Projection Expressions