Skip to content

Commit 3f6aa8a

Browse files
committed
Wherenode: Handle not with and condition.
1 parent 98a5835 commit 3f6aa8a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

django_mongodb/features.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
353353
# "model_fields.test_jsonfield.TestQuerying.test_isnull_key",
354354
"model_fields.test_jsonfield.TestSaveLoad.test_json_null_different_from_sql_null",
355355
"model_fields.test_jsonfield.TestQuerying.test_none_key",
356+
"model_fields.test_jsonfield.TestQuerying.test_lookup_exclude",
357+
"model_fields.test_jsonfield.TestQuerying.test_lookup_exclude_nonexistent_key",
356358
},
357359
"Pipeline filtering": {"model_fields.test_jsonfield.TestQuerying.test_icontains"},
358360
}

django_mongodb/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def where_node(self, compiler, connection):
156156

157157
if self.negated and mql:
158158
lhs, rhs = next(iter(mql.items()))
159-
mql = {"$nor": rhs} if lhs == "$or" else {lhs: {"$not": rhs}}
159+
mql = {"$nor": rhs} if lhs == "$or" else {"$nor": [mql]}
160160

161161
return mql
162162

0 commit comments

Comments
 (0)