Skip to content

Commit 6a446cb

Browse files
committed
DATAMONGO-1325 - Polishing.
Add since tag to new method. Set year of inception in copyright header. Add ticket reference to test. Minor code reformatting. Add integration test. Change query keyword for query-by-example from $sample to $example to prevent accidental collisions. Remove Mongo 3.4-next build profile due to removed Mongo 3.4 driver snapshots. Original pull request: spring-projects#452.
1 parent d40084f commit 6a446cb

File tree

7 files changed

+110
-86
lines changed

7 files changed

+110
-86
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ before_script:
99
env:
1010
matrix:
1111
- PROFILE=ci
12-
- PROFILE=mongo34-next
1312
- PROFILE=mongo35-next
1413

1514
# Current MongoDB version is 2.4.2 as of 2016-04, see https://github.com/travis-ci/travis-ci/issues/3694

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

+3-8
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,17 @@
1717

1818
import static org.springframework.data.mongodb.core.aggregation.Fields.*;
1919

20-
import java.util.ArrayList;
2120
import java.util.Arrays;
2221
import java.util.List;
2322

2423
import org.bson.Document;
2524
import org.springframework.data.domain.Sort;
2625
import org.springframework.data.domain.Sort.Direction;
2726
import org.springframework.data.mongodb.core.aggregation.CountOperation.CountOperationBuilder;
28-
import org.springframework.data.mongodb.core.aggregation.ExposedFields.DirectFieldReference;
29-
import org.springframework.data.mongodb.core.aggregation.ExposedFields.ExposedField;
30-
import org.springframework.data.mongodb.core.aggregation.ExposedFields.FieldReference;
3127
import org.springframework.data.mongodb.core.aggregation.FacetOperation.FacetOperationBuilder;
32-
import org.springframework.data.mongodb.core.aggregation.FieldsExposingAggregationOperation.InheritsFieldsAggregationOperation;
3328
import org.springframework.data.mongodb.core.aggregation.GraphLookupOperation.StartWithBuilder;
3429
import org.springframework.data.mongodb.core.aggregation.ReplaceRootOperation.ReplaceRootDocumentOperationBuilder;
3530
import org.springframework.data.mongodb.core.aggregation.ReplaceRootOperation.ReplaceRootOperationBuilder;
36-
import org.springframework.data.mongodb.core.aggregation.Fields.*;
3731
import org.springframework.data.mongodb.core.query.Criteria;
3832
import org.springframework.data.mongodb.core.query.CriteriaDefinition;
3933
import org.springframework.data.mongodb.core.query.NearQuery;
@@ -384,15 +378,16 @@ public static LimitOperation limit(long maxElements) {
384378
}
385379

386380
/**
387-
* Creates a new {@link SampleOperation} to selects the specified number of documents from its input randomly.
381+
* Creates a new {@link SampleOperation} to select the specified number of documents from its input randomly.
388382
*
389383
* @param sampleSize must not be less than zero.
390384
* @return
385+
* @since 2.0
391386
*/
392387
public static SampleOperation sample(long sampleSize) {
393388
return new SampleOperation(sampleSize);
394389
}
395-
390+
396391
/**
397392
* Creates a new {@link MatchOperation} using the given {@link Criteria}.
398393
*

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2017 the original author or authors.
2+
* Copyright 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,7 +26,8 @@
2626
*
2727
* @author Gustavo de Geus
2828
* @since 2.0
29-
* @see <a href="https://docs.mongodb.com/master/reference/operator/aggregation/sample/">MongoDB Aggregation Framework: $sample</a>
29+
* @see <a href="https://docs.mongodb.com/master/reference/operator/aggregation/sample/">MongoDB Aggregation Framework:
30+
* $sample</a>
3031
*/
3132
public class SampleOperation implements AggregationOperation {
3233

0 commit comments

Comments
 (0)