Browse Source

DATAMONGO-2370 - Polishing.

Align since version to 2.3 until we have an indication for a major version bump. Tweak docs.

Original pull request: #803.
pull/809/head
Mark Paluch 6 years ago
parent
commit
cd4e4065ff
No known key found for this signature in database
GPG Key ID: 51A00FA751B91849
  1. 8
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ArithmeticOperators.java
  2. 5
      spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ArithmeticOperatorsUnitTests.java
  3. 2
      src/main/asciidoc/reference/mongodb.adoc

8
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ArithmeticOperators.java

@ -516,7 +516,7 @@ public class ArithmeticOperators {
* place. * place.
* *
* @return new instance of {@link Round}. * @return new instance of {@link Round}.
* @since 3.0 * @since 2.3
*/ */
public Round round() { public Round round() {
return usesFieldRef() ? Round.roundValueOf(fieldReference) : Round.roundValueOf(expression); return usesFieldRef() ? Round.roundValueOf(fieldReference) : Round.roundValueOf(expression);
@ -526,7 +526,7 @@ public class ArithmeticOperators {
* Creates new {@link AggregationExpression} that rounds a number to a specified decimal place. * Creates new {@link AggregationExpression} that rounds a number to a specified decimal place.
* *
* @return new instance of {@link Round}. * @return new instance of {@link Round}.
* @since 3.0 * @since 2.3
*/ */
public Round roundToPlace(int place) { public Round roundToPlace(int place) {
return round().place(place); return round().place(place);
@ -1445,7 +1445,7 @@ public class ArithmeticOperators {
} }
/** /**
* {@link Round} rounds a number to a whole integer or to a specified decimal place. <br /> * {@link Round} rounds a number to a whole integer or to a specified decimal place.
* <ul> * <ul>
* <li>If {@link Round#place(int)} resolves to a positive integer, {@code $round} rounds to the given decimal * <li>If {@link Round#place(int)} resolves to a positive integer, {@code $round} rounds to the given decimal
* places.</li> * places.</li>
@ -1455,7 +1455,7 @@ public class ArithmeticOperators {
* decimal.</li> * decimal.</li>
* </ul> * </ul>
* *
* @since 3.0 * @since 2.3
*/ */
public static class Round extends AbstractAggregationExpression { public static class Round extends AbstractAggregationExpression {

5
spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ArithmeticOperatorsUnitTests.java

@ -25,9 +25,10 @@ import org.bson.Document;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
/** /**
* Unit tests for {@link Round}.
*
* @author Christoph Strobl * @author Christoph Strobl
*/ */
public class ArithmeticOperatorsUnitTests { public class ArithmeticOperatorsUnitTests {
@Test // DATAMONGO-2370 @Test // DATAMONGO-2370
@ -41,7 +42,7 @@ public class ArithmeticOperatorsUnitTests {
void roundShouldWithPlace() { void roundShouldWithPlace() {
assertThat(valueOf("field").roundToPlace(3).toDocument(Aggregation.DEFAULT_CONTEXT)) assertThat(valueOf("field").roundToPlace(3).toDocument(Aggregation.DEFAULT_CONTEXT))
.isEqualTo(new Document("$round", Arrays.asList("$field", Integer.valueOf(3)))); .isEqualTo(new Document("$round", Arrays.asList("$field", 3)));
} }
@Test // DATAMONGO-2370 @Test // DATAMONGO-2370

2
src/main/asciidoc/reference/mongodb.adoc

@ -2516,7 +2516,7 @@ At the time of this writing, we provide support for the following Aggregation Op
| `addToSet`, `first`, `last`, `max`, `min`, `avg`, `push`, `sum`, `(*count)`, `stdDevPop`, `stdDevSamp` | `addToSet`, `first`, `last`, `max`, `min`, `avg`, `push`, `sum`, `(*count)`, `stdDevPop`, `stdDevSamp`
| Arithmetic Aggregation Operators | Arithmetic Aggregation Operators
| `abs`, `add` (*via `plus`), `ceil`, `divide`, `exp`, `floor`, `ln`, `log`, `log10`, `mod`, `multiply`, `pow`, `sqrt`, `subtract` (*via `minus`), `trunc`, `round` | `abs`, `add` (*via `plus`), `ceil`, `divide`, `exp`, `floor`, `ln`, `log`, `log10`, `mod`, `multiply`, `pow`, `round`, `sqrt`, `subtract` (*via `minus`), `trunc`
| String Aggregation Operators | String Aggregation Operators
| `concat`, `substr`, `toLower`, `toUpper`, `stcasecmp`, `indexOfBytes`, `indexOfCP`, `split`, `strLenBytes`, `strLenCP`, `substrCP`, `trim`, `ltrim`, `rtim` | `concat`, `substr`, `toLower`, `toUpper`, `stcasecmp`, `indexOfBytes`, `indexOfCP`, `split`, `strLenBytes`, `strLenCP`, `substrCP`, `trim`, `ltrim`, `rtim`

Loading…
Cancel
Save