use of org.springframework.data.mongodb.core.aggregation.ExposedFields.DirectFieldReference in project spring-data-mongodb by spring-projects.
the class TypeBasedAggregationOperationContext method getReferenceFor.
private FieldReference getReferenceFor(Field field) {
PersistentPropertyPath<MongoPersistentProperty> propertyPath = mappingContext.getPersistentPropertyPath(field.getTarget(), type);
Field mappedField = field(field.getName(), propertyPath.toDotPath(MongoPersistentProperty.PropertyToFieldNameConverter.INSTANCE));
return new DirectFieldReference(new ExposedField(mappedField, true));
}
use of org.springframework.data.mongodb.core.aggregation.ExposedFields.DirectFieldReference in project spring-data-mongodb by spring-projects.
the class TypeBasedAggregationOperationContextUnitTests method aliasesIdFieldCorrectly.
// DATAMONGO-806
@Test
public void aliasesIdFieldCorrectly() {
AggregationOperationContext context = getContext(Foo.class);
assertThat(context.getReference("id"), is(new DirectFieldReference(new ExposedField(field("id", "_id"), true))));
}
Aggregations