use of org.springframework.data.mongodb.core.QueryOperations.AggregationDefinition in project spring-data-mongodb by spring-projects.
the class QueryOperationsUnitTests method createAggregationContextUsesStrictlyTypedContextForTypedAggregationsWhenRequested.
// GH-3542
@Test
void createAggregationContextUsesStrictlyTypedContextForTypedAggregationsWhenRequested() {
Aggregation aggregation = Aggregation.newAggregation(Person.class, Aggregation.project("name")).withOptions(STRICT_MAPPING);
AggregationDefinition ctx = queryOperations.createAggregation(aggregation, (Class<?>) null);
assertThat(ctx.getAggregationOperationContext()).isInstanceOf(TypeBasedAggregationOperationContext.class);
}
use of org.springframework.data.mongodb.core.QueryOperations.AggregationDefinition in project spring-data-mongodb by spring-projects.
the class QueryOperationsUnitTests method createAggregationContextUsesRelaxedOneForUntypedAggregationsWhenNoInputTypeProvided.
// GH-3542
@Test
void createAggregationContextUsesRelaxedOneForUntypedAggregationsWhenNoInputTypeProvided() {
Aggregation aggregation = Aggregation.newAggregation(Aggregation.project("name"));
AggregationDefinition ctx = queryOperations.createAggregation(aggregation, (Class<?>) null);
assertThat(ctx.getAggregationOperationContext()).isInstanceOf(RelaxedTypeBasedAggregationOperationContext.class);
}
Aggregations