Skip to content

Commit 9fb4ca5

Browse files
committed
add Value support
1 parent 9112d93 commit 9fb4ca5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

django_mongodb/expressions.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
from django.db.models.expressions import Col
1+
from django.db.models.expressions import Col, Value
22

33

44
def col(self, compiler, connection): # noqa: ARG001
55
return f"${self.target.column}"
66

77

8+
def value(self, compiler, connection): # noqa: ARG001
9+
return self.value
10+
11+
812
def register_expressions():
913
Col.as_mql = col
14+
Value.as_mql = value

django_mongodb/features.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
134134
"lookup.tests.LookupQueryingTests.test_filter_exists_lhs",
135135
# QuerySet.alias() doesn't work.
136136
"lookup.tests.LookupQueryingTests.test_alias",
137-
# Value() not supported.
138-
"lookup.tests.LookupQueryingTests.test_annotate_literal_greater_than_field",
139-
"lookup.tests.LookupQueryingTests.test_annotate_value_greater_than_value",
140137
# annotate() with combined expressions doesn't work:
141138
# 'WhereNode' object has no attribute 'field'
142139
"lookup.tests.LookupQueryingTests.test_combined_annotated_lookups_in_filter",

0 commit comments

Comments
 (0)