Skip to content

Conversation

@christophstrobl
Copy link
Member

We now allow to derive field names for a $project stage from a given type by including all top level fields.

// $project : { title : 1, author : 1 }
Aggregation.project(Book.class)

Requires changes from: #743

@christophstrobl christophstrobl marked this pull request as ready for review May 21, 2019 10:37
public Document toDocument(AggregationOperationContext context) {

Document projections = new Document();
ReflectionUtils.doWithFields(type, it -> projections.append(it.getName(), 1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should differentiate here and rely on our meta-model. One might want to use property accessors instead or hand in a projection interface.

…given type.

We now allow to derive field names for a $project stage from a given type by including all top level fields.

    // $project : { title : 1, author : 1 }
    Aggregation.project(Book.class)
Use the mapping context to get the required fields or fall back to property descriptors if no mapping context is available.
mp911de pushed a commit that referenced this pull request Jul 2, 2019
…given type.

We now allow to derive field names for a $project stage from a given type by including all top level fields.

    // $project : { title : 1, author : 1 }
    Aggregation.project(Book.class)

Original pull request: #748.
mp911de pushed a commit that referenced this pull request Jul 2, 2019
Use the mapping context to get the required fields or fall back to property descriptors if no mapping context is available.

Original pull request: #748.
mp911de added a commit that referenced this pull request Jul 2, 2019
Tweak Javadoc. Simplify Fields creation from Stream. Remove final modifier from private static method. Iterate with loop over PersistentEntity.

Original pull request: #748.
@mp911de
Copy link
Member

mp911de commented Jul 2, 2019

That's merged and polished now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants