@@ -128,20 +128,20 @@ def func_expr(self, compiler, connection):
128128
129129
130130def left (self , compiler , connection ):
131- return self .get_substr ().as_mql (compiler , connection , as_path = False )
131+ return self .get_substr ().as_mql (compiler , connection )
132132
133133
134134def length (self , compiler , connection ):
135135 # Check for null first since $strLenCP only accepts strings.
136- lhs_mql = process_lhs (self , compiler , connection , as_path = False )
136+ lhs_mql = process_lhs (self , compiler , connection )
137137 return {"$cond" : {"if" : {"$eq" : [lhs_mql , None ]}, "then" : None , "else" : {"$strLenCP" : lhs_mql }}}
138138
139139
140140def log (self , compiler , connection ):
141141 # This function is usually log(base, num) but on MongoDB it's log(num, base).
142142 clone = self .copy ()
143143 clone .set_source_expressions (self .get_source_expressions ()[::- 1 ])
144- return func (clone , compiler , connection , as_path = False )
144+ return func (clone , compiler , connection )
145145
146146
147147def now (self , compiler , connection ): # noqa: ARG001
@@ -150,17 +150,15 @@ def now(self, compiler, connection): # noqa: ARG001
150150
151151def null_if (self , compiler , connection ):
152152 """Return None if expr1==expr2 else expr1."""
153- expr1 , expr2 = (
154- expr .as_mql (compiler , connection , as_path = False ) for expr in self .get_source_expressions ()
155- )
153+ expr1 , expr2 = (expr .as_mql (compiler , connection ) for expr in self .get_source_expressions ())
156154 return {"$cond" : {"if" : {"$eq" : [expr1 , expr2 ]}, "then" : None , "else" : expr1 }}
157155
158156
159157def preserve_null (operator ):
160158 # If the argument is null, the function should return null, not
161159 # $toLower/Upper's behavior of returning an empty string.
162160 def wrapped (self , compiler , connection ):
163- lhs_mql = process_lhs (self , compiler , connection , as_path = False )
161+ lhs_mql = process_lhs (self , compiler , connection )
164162 return {
165163 "$cond" : {
166164 "if" : connection .mongo_expr_operators ["isnull" ](lhs_mql , True ),
@@ -173,23 +171,18 @@ def wrapped(self, compiler, connection):
173171
174172
175173def replace (self , compiler , connection ):
176- expression , text , replacement = process_lhs (self , compiler , connection , as_path = False )
174+ expression , text , replacement = process_lhs (self , compiler , connection )
177175 return {"$replaceAll" : {"input" : expression , "find" : text , "replacement" : replacement }}
178176
179177
180178def round_ (self , compiler , connection ):
181179 # Round needs its own function because it's a special case that inherits
182180 # from Transform but has two arguments.
183- return {
184- "$round" : [
185- expr .as_mql (compiler , connection , as_path = False )
186- for expr in self .get_source_expressions ()
187- ]
188- }
181+ return {"$round" : [expr .as_mql (compiler , connection ) for expr in self .get_source_expressions ()]}
189182
190183
191184def str_index (self , compiler , connection ):
192- lhs = process_lhs (self , compiler , connection , as_path = False )
185+ lhs = process_lhs (self , compiler , connection )
193186 # StrIndex should be 0-indexed (not found) but it's -1-indexed on MongoDB.
194187 return {"$add" : [{"$indexOfCP" : lhs }, 1 ]}
195188
@@ -253,7 +246,7 @@ def trunc_convert_value(self, value, expression, connection):
253246
254247def trunc_date (self , compiler , connection ):
255248 # Cast to date rather than truncate to date.
256- lhs_mql = process_lhs (self , compiler , connection , as_path = False )
249+ lhs_mql = process_lhs (self , compiler , connection )
257250 tzname = self .get_tzname ()
258251 if tzname and tzname != "UTC" :
259252 raise NotSupportedError (f"TruncDate with tzinfo ({ tzname } ) isn't supported on MongoDB." )
@@ -276,7 +269,7 @@ def trunc_time(self, compiler, connection):
276269 tzname = self .get_tzname ()
277270 if tzname and tzname != "UTC" :
278271 raise NotSupportedError (f"TruncTime with tzinfo ({ tzname } ) isn't supported on MongoDB." )
279- lhs_mql = process_lhs (self , compiler , connection , as_path = False )
272+ lhs_mql = process_lhs (self , compiler , connection )
280273 return {
281274 "$dateFromString" : {
282275 "dateString" : {
0 commit comments