Polishing.

Update javadoc to reflect recent changes and split tests.

Original Pull Request: #4666
This commit is contained in:
Christoph Strobl
2024-03-19 11:56:55 +01:00
parent 52ba939bd7
commit d294d50407
2 changed files with 21 additions and 0 deletions

View File

@@ -33,6 +33,10 @@ import com.mongodb.ReadPreference;
* Holds a set of configurable aggregation options that can be used within an aggregation pipeline. A list of support
* aggregation options can be found in the
* <a href="https://docs.mongodb.org/manual/reference/command/aggregate/#aggregate">MongoDB reference documentation</a>.
* <p>
* As off 4.3 {@link #allowDiskUse} can be {@literal null}, indicating use of server default, and may only be applied if
* {@link #isAllowDiskUseSet() explicitly set}. For compatibility reasons {@link #isAllowDiskUse()} will remain
* returning {@literal false} if the no value has been set.
*
* @author Thomas Darimont
* @author Oliver Gierke

View File

@@ -86,6 +86,12 @@ class AggregationOptionsTests {
assertThat(aggregationOptions.isAllowDiskUseSet()).isFalse();
assertThat(aggregationOptions.toDocument()).doesNotContainKey("allowDiskUse");
}
@Test // GH-4664
void applyOptionsDoesNotChangeAllowDiskUseDefault() {
aggregationOptions = AggregationOptions.fromDocument(new Document());
Document empty = new Document();
aggregationOptions.applyAndReturnPotentiallyChangedCommand(empty);
@@ -93,6 +99,17 @@ class AggregationOptionsTests {
assertThat(empty).doesNotContainKey("allowDiskUse");
}
@Test // GH-4664
void applyOptionsDoesNotChangeExistingAllowDiskUse() {
aggregationOptions = AggregationOptions.fromDocument(new Document());
Document existing = new Document("allowDiskUse", true);
aggregationOptions.applyAndReturnPotentiallyChangedCommand(existing);
assertThat(existing).containsEntry("allowDiskUse", true);
}
@Test // DATAMONGO-960, DATAMONGO-2153, DATAMONGO-1836
void aggregationOptionsToString() {