From 2148c7b6f1c84efe89d9707ab9b36d0c8ba6154c Mon Sep 17 00:00:00 2001 From: matthewpeterkort Date: Wed, 17 Jul 2024 10:32:37 -0700 Subject: [PATCH] fix Mongo test --- mongo/has_evaluator.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mongo/has_evaluator.go b/mongo/has_evaluator.go index df3462a1..bc8f5a5b 100644 --- a/mongo/has_evaluator.go +++ b/mongo/has_evaluator.go @@ -86,7 +86,17 @@ func convertCondition(cond *gripql.HasCondition, not bool) bson.M { var key string var val interface{} key = ToPipelinePath(cond.Key) - val = cond.Value.AsInterface() + val = cond.Value.AsInterface + // Adds new behavior in float64 type casting that casts nil values to 0 + if val == nil && + cond.Condition != gripql.Condition_EQ && + cond.Condition != gripql.Condition_NEQ && + cond.Condition != gripql.Condition_WITHIN && + cond.Condition != gripql.Condition_WITHOUT && + cond.Condition != gripql.Condition_CONTAINS && + !not { + val = 0 + } expr := bson.M{} switch cond.Condition { case gripql.Condition_EQ: