Skip to content

Relax field name checks for TypedAggregations. #3542

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
christophstrobl opened this issue Jan 21, 2021 · 0 comments
Closed

Relax field name checks for TypedAggregations. #3542

christophstrobl opened this issue Jan 21, 2021 · 0 comments
Labels
type: enhancement A general enhancement

Comments

@christophstrobl
Copy link
Member

Mapping field names to domain type properties should not fail if a given field name does not correspond to a property of the target domain type as it might only be part of the document stored in MongoDB.

This would allow to eg. write aggregations like

Aggregation.newAggregation(group("_id").first("name").as("name"));

without having to project("id", "name") on the fields upfront.


Relates to: #3466

christophstrobl added a commit that referenced this issue Jan 25, 2021
This commit switches from a strict to a relaxed type mapping for aggregation executions. This allows users to add fields to the aggregation that might be part of the stored document but not necessarily of its java model representation.
Instead of throwing an exception in those cases the relaxed type check will go on with the user provided field names.
To restore the original behaviour use the strictMapping() option on AggregationOptions.

Closes #3542
@mp911de mp911de added this to the 3.2 M3 (2021.0.0) milestone Jan 27, 2021
@mp911de mp911de added the type: enhancement A general enhancement label Jan 27, 2021
mp911de added a commit that referenced this issue Jan 27, 2021
Tweak wording in the docs. Remove unused code. Fix generics. Rename AggregateContext to AggregationOperation to AggregationDefinition to avoid yet another Context object.

See #3542.
Original pull request: #3545.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants