-
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 string to objectId mapping error when using query method. #4519
Conversation
@grwang91 thank you for the the PR! |
resultDbo.put(inKey, ids); | ||
} else if (valueDbo.containsKey("$ne")) { | ||
resultDbo.put("$ne", convertId(valueDbo.get("$ne"), getIdTypeForField(documentField))); | ||
} else if (containsCompareOperator(valueDbo)) { |
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 curious if we need to explicitly check on the presence of certain keys here. What might also work would be to check if the key is a keyword and then call convertIdField
with the value.
private Object convertIdField(Field documentField, Object source) {
// ... logic for $in,...
for(Entry<String,Object> entry : valueDbo.entrySet()) {
if(isKeyword(entry.getKey())) {
resultDbo.put(entry.getKey(), convertIdField(documentField, entry.getValue()));
} else {
resultDbo.put(entry.getKey(), getMappedValue(documentField, entry.getValue()));
}
}
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.
Thanks for suggestion. I will apply it!
I think I'd like to see the changes contained in #4517 go in first and then bring in additional logic for handling the |
Thank you for your contribution. That's merged and polished now. |
Fixed objectId conversion issue.
Merged common codes into method.
Resolves: #4490