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.
This commit is contained in:
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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`
|
||||||
|
|||||||
Reference in New Issue
Block a user