Skip to content

Commit fe2cba2

Browse files
committed
replace list with tuple in $in expr for consistency
1 parent 175563b commit fe2cba2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

django_mongodb_backend/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _regex_expr(field, regex_vals, insensitive=False):
173173
# SQL behavior.
174174
"lt": lambda a, b: {"$and": [{"$lt": [a, b]}, DatabaseWrapper._isnull_expr(a, False)]},
175175
"lte": lambda a, b: {"$and": [{"$lte": [a, b]}, DatabaseWrapper._isnull_expr(a, False)]},
176-
"in": lambda a, b: {"$in": [a, b]},
176+
"in": lambda a, b: {"$in": [a, tuple(b)]},
177177
"isnull": _isnull_expr,
178178
"range": lambda a, b: {
179179
"$and": [

tests/model_fields_/test_arrayfield.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,13 +454,13 @@ def test_in_expr(self):
454454
{
455455
"$match": {
456456
"$expr": {
457-
"$in": (
457+
"$in": [
458458
"$field",
459-
[
459+
(
460460
[{"$multiply": [{"$literal": 1}, {"$literal": 1}]}],
461461
[{"$literal": 2}],
462-
],
463-
)
462+
),
463+
]
464464
}
465465
}
466466
}

0 commit comments

Comments
 (0)