Skip to content

Commit c26e07a

Browse files
committed
Add isnull expression in partial index.
1 parent 8489223 commit c26e07a

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

132136
display_name = "MongoDB"

0 commit comments

Comments
 (0)