Skip to content

Commit ff3770a

Browse files
committed
Add isnull expression in partial index.
1 parent 3c92a63 commit ff3770a

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
@@ -125,6 +125,10 @@ def _isnull_operator(a, b):
125125
"lt": lambda a, b: {a: {"$lt": b}},
126126
"lte": lambda a, b: {a: {"$lte": b}},
127127
"in": lambda a, b: {a: {"$in": b}},
128+
# Partial indexes do not support the $not expression.
129+
# Operators like $exists: False, $ne, and $nor cannot be used in partial indexes.
130+
# So, indexes on null values (isnull=True|False) can't be implemented.
131+
"isnull": lambda a, b: {}, # noqa: ARG005
128132
}
129133

130134
display_name = "MongoDB"

0 commit comments

Comments
 (0)