GODRIVER-3987: Implement conditional, higher-order, and misc expression operators and tests - #16
Merged
Merged
Conversation
…on operators and tests.
qingyang-hu
reviewed
Jul 20, 2026
Comment on lines
+718
to
+720
| if o.hasOnError { | ||
| doc = append(doc, bson.E{Key: "onError", Value: o.onError}) | ||
| } |
There was a problem hiding this comment.
[suggestion] Is it possible to extend the hasOnError/hasDefault pattern to the older WithConvertOnError/WithConvertOnNull/WithShiftDefault options, where nulls are dropped silently?
qingyang-hu
reviewed
Jul 20, 2026
Comment on lines
+828
to
+830
| if o.lang != nil { | ||
| lang = o.lang.(string) | ||
| } |
There was a problem hiding this comment.
[suggestion] Maybe we can use a hasLang here?
qingyang-hu
reviewed
Jul 20, 2026
| } | ||
| return AnyExpr{expr: bson.D{{Key: "$function", Value: bson.D{ | ||
| {Key: "body", Value: bson.JavaScript(body)}, | ||
| {Key: "args", Value: args}, |
There was a problem hiding this comment.
[blocking] We need to normalize a nil args slice to a non-nil empty slice:
if args == nil {
args = []Expr{}
}Otherwise, the function returns args: null.
A test case is also worthwhile to safeguard it.
qingyang-hu
requested changes
Jul 20, 2026
qingyang-hu
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GODRIVER-3987
Implements the following operators and their corresponding tests:
Adds the
stringtype to theBoolResolvertype.Fixes
Concatto allow concatenation of different types.Renames
FilterArraytoFilterfor consistency with operator name: $filter.