29
29
import org .apache .commons .logging .LogFactory ;
30
30
import org .bson .Document ;
31
31
import org .bson .conversions .Bson ;
32
+
32
33
import org .springframework .beans .BeansException ;
33
34
import org .springframework .context .ApplicationContext ;
34
35
import org .springframework .context .ApplicationContextAware ;
@@ -2070,6 +2071,8 @@ public <T> GroupByResults<T> group(@Nullable Criteria criteria, String inputColl
2070
2071
*/
2071
2072
@ Override
2072
2073
public <O > AggregationResults <O > aggregate (TypedAggregation <?> aggregation , Class <O > outputType ) {
2074
+
2075
+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
2073
2076
return aggregate (aggregation , getCollectionName (aggregation .getInputType ()), outputType );
2074
2077
}
2075
2078
@@ -2079,9 +2082,6 @@ public <O> AggregationResults<O> aggregate(TypedAggregation<?> aggregation, Clas
2079
2082
@ Override
2080
2083
public <O > AggregationResults <O > aggregate (TypedAggregation <?> aggregation , String inputCollectionName ,
2081
2084
Class <O > outputType ) {
2082
-
2083
- Assert .notNull (aggregation , "Aggregation pipeline must not be null!" );
2084
-
2085
2085
return aggregate (aggregation , inputCollectionName , outputType , null );
2086
2086
}
2087
2087
@@ -2091,6 +2091,7 @@ public <O> AggregationResults<O> aggregate(TypedAggregation<?> aggregation, Stri
2091
2091
@ Override
2092
2092
public <O > AggregationResults <O > aggregate (Aggregation aggregation , Class <?> inputType , Class <O > outputType ) {
2093
2093
2094
+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
2094
2095
return aggregate (aggregation , getCollectionName (inputType ), outputType ,
2095
2096
queryOperations .createAggregation (aggregation , inputType ).getAggregationOperationContext ());
2096
2097
}
@@ -2109,8 +2110,6 @@ public <O> AggregationResults<O> aggregate(Aggregation aggregation, String colle
2109
2110
@ Override
2110
2111
public <O > CloseableIterator <O > aggregateStream (TypedAggregation <?> aggregation , String inputCollectionName ,
2111
2112
Class <O > outputType ) {
2112
-
2113
- Assert .notNull (aggregation , "Aggregation pipeline must not be null!" );
2114
2113
return aggregateStream (aggregation , inputCollectionName , outputType , null );
2115
2114
}
2116
2115
@@ -2119,6 +2118,8 @@ public <O> CloseableIterator<O> aggregateStream(TypedAggregation<?> aggregation,
2119
2118
*/
2120
2119
@ Override
2121
2120
public <O > CloseableIterator <O > aggregateStream (TypedAggregation <?> aggregation , Class <O > outputType ) {
2121
+
2122
+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
2122
2123
return aggregateStream (aggregation , getCollectionName (aggregation .getInputType ()), outputType );
2123
2124
}
2124
2125
@@ -2128,6 +2129,7 @@ public <O> CloseableIterator<O> aggregateStream(TypedAggregation<?> aggregation,
2128
2129
@ Override
2129
2130
public <O > CloseableIterator <O > aggregateStream (Aggregation aggregation , Class <?> inputType , Class <O > outputType ) {
2130
2131
2132
+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
2131
2133
return aggregateStream (aggregation , getCollectionName (inputType ), outputType ,
2132
2134
queryOperations .createAggregation (aggregation , inputType ).getAggregationOperationContext ());
2133
2135
}
@@ -2286,8 +2288,8 @@ protected <O> AggregationResults<O> doAggregate(Aggregation aggregation, String
2286
2288
protected <O > CloseableIterator <O > aggregateStream (Aggregation aggregation , String collectionName ,
2287
2289
Class <O > outputType , @ Nullable AggregationOperationContext context ) {
2288
2290
2289
- Assert .hasText (collectionName , "Collection name must not be null or empty!" );
2290
2291
Assert .notNull (aggregation , "Aggregation pipeline must not be null!" );
2292
+ Assert .hasText (collectionName , "Collection name must not be null or empty!" );
2291
2293
Assert .notNull (outputType , "Output type must not be null!" );
2292
2294
Assert .isTrue (!aggregation .getOptions ().isExplain (), "Can't use explain option with streaming!" );
2293
2295
0 commit comments