File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
django_mongodb_backend/query_conversion Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,9 @@ def convert(cls, args):
7777 # Check if first argument is a simple field reference.
7878 if (field_name := cls .convert_path_name (field_expr )) and cls .is_simple_value (value ):
7979 if cls .operator == "$eq" :
80- return {field_name : {"$exists" : False } if value is None else value }
80+ if value is None :
81+ return {"$and" : [{field_name : {"$exists" : True }}, {field_name : None }]}
82+ return {field_name : value }
8183 return {field_name : {cls .operator : value }}
8284 return None
8385
@@ -131,7 +133,7 @@ def convert(cls, in_args):
131133 field_expr , values = in_args
132134 # Check if first argument is a simple field reference
133135 # Check if second argument is a list of simple values
134- if (field_name := cls .convert_path_name (field_expr )) and (
136+ if (field_name := cls . (field_expr )) and (
135137 isinstance (values , list | tuple | set )
136138 and all (cls .is_simple_value (v ) for v in values )
137139 ):
You can’t perform that action at this time.
0 commit comments