Skip to content

DATAMONGO-2200 - Derive fields for aggregation $project stage from a given type. #748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

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