Skip to content

Commit 7044495

Browse files
committed
Add isnull expression in partial index.
1 parent 29949cb commit 7044495

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

django_mongodb/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ def _isnull_operator(a, b):
126126
"lt": lambda a, b: {a: {"$lt": b}},
127127
"lte": lambda a, b: {a: {"$lte": b}},
128128
"in": lambda a, b: {a: {"$in": b}},
129+
# Partial indexes do not support the $not expression.
130+
# Operators like $exists: False, $ne, and $nor cannot be used in partial indexes.
131+
# So, indexes on null values (isnull=True|False) can't be implemented.
132+
"isnull": lambda a, b: {}, # noqa: ARG005
129133
}
130134

131135
display_name = "MongoDB"

0 commit comments

Comments
 (0)