-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
CSHARP-5461: Add targetSerializer parameter to Translate methods. #1596
base: main
Are you sure you want to change the base?
Conversation
…pressionTranslator.
…tionExpressionTranslator.Translate(context,.
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.
Minor comment + there are some failed tests, probably have to check them before completing the PR.
} | ||
var creatorMapArguments = creatorMap?.Arguments?.ToArray(); | ||
|
||
for (var i = 0; i < constructorParameters.Length; i++) |
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.
Should we iterate over creatorMap arguments instead? In such case we do not need to do a member lookup and will use custom member if it was configured explicitly.
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.
No because the creatorMap
could be null
.
We only have a creatorMap
IFF the serializer is an IBsonClassMapSerializer
and not all serializers are.
coll.UpdateOne(filter, updateError, new() { IsUpsert = true }); | ||
} | ||
|
||
// [Fact] |
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.
We probably can either remove this test at all or expect an error here, as we do not support the functionality for now.
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 will remove it before the final commit for this PR.
For now I didn't want to forget about it, but I also didn't want the patch builds to fail.
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.
LGTM
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.
Don't we need to also add a targetSerializer parameter for NewHashSetExpressionToAggregationExpressionTranslator
and NewListExpressionToAggregationExpressionTranslator
?
itemSerializer ??= itemTranslation.Serializer; | ||
if (itemSerializer == null) | ||
{ | ||
itemSerializer = itemTranslation.Serializer; | ||
} |
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 think this change is unnecessary?
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.
You are right I guess. It's just two ways of writing the same thing.
I don't think I intentionally meant to change it. I think I deleted the line at one point and later realized I needed this to happen and I just wrote it differently.
Which version do you like better? The shorter version or the clearer version?
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'll prefer the shorter version
No description provided.