-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix conversion of types when mapping Aggregation pipeline #4723
Conversation
This change makes sure to apply conversion to non native mongo types when the context does not expose fields.
@@ -62,7 +62,7 @@ static List<Document> toDocument(List<AggregationOperation> operations, Aggregat | |||
if (operation instanceof InheritsFieldsAggregationOperation || exposedFieldsOperation.inheritsFields()) { | |||
contextToUse = contextToUse.inheritAndExpose(fields); | |||
} else { | |||
contextToUse = fields.exposesNoFields() ? DEFAULT_CONTEXT | |||
contextToUse = fields.exposesNoFields() ? ConverterAwareNoOpContext.instance(rootContext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow why we have this distinction here. Switching to contextToUse = contextToUse.expose(fields);
also lets all the tests pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might cause the mapping to consider filenames of follow up stages to be object to field name mapping which should not be done. if no tests fail, we should make sure that we have coverage there and do not hit a blank spot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, then this one needs to wait for the next service release as we supposedly do not have sufficient test coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirmed, we're missing a test here - like if we have an operation that forces field mapping to back off (like the replaceRoot one) a strict context would fail because of the missing exposure.
Hello @christophstrobl , |
Hello @christophstrobl , Are there any updates regarding this ticket? Was the test necessary for the ticket to be merged added? Thank you, |
This PR makes sure to apply conversion to non native mongo types when the context does not expose fields.
Resolves: #4722