@@ -140,30 +140,11 @@ def key_transform_exact_path(self, compiler, connection):
140
140
}
141
141
142
142
143
- def key_transform_in (self , compiler , connection , as_path = False ):
143
+ def key_transform_in_expr (self , compiler , connection ):
144
144
"""
145
145
Return MQL to check if a JSON path exists and that its values are in the
146
146
set of specified values (rhs).
147
147
"""
148
- if as_path and self .can_use_path ():
149
- return builtin_lookup_path (self , compiler , connection )
150
-
151
- lhs_mql = process_lhs (self , compiler , connection )
152
- # Traverse to the root column.
153
- previous = self .lhs
154
- while isinstance (previous , KeyTransform ):
155
- previous = previous .lhs
156
- root_column = previous .as_mql (compiler , connection )
157
- value = process_rhs (self , compiler , connection )
158
- # Construct the expression to check if lhs_mql values are in rhs values.
159
- expr = connection .mongo_expr_operators [self .lookup_name ](lhs_mql , value )
160
- expr = {"$and" : [_has_key_predicate (lhs_mql , root_column ), expr ]}
161
- if as_path :
162
- return {"$expr" : expr }
163
- return expr
164
-
165
-
166
- def key_transform_in_expr (self , compiler , connection ):
167
148
lhs_mql = process_lhs (self , compiler , connection )
168
149
# Traverse to the root column.
169
150
previous = self .lhs
0 commit comments