Skip to content

Commit 1f8ea14

Browse files
committed
add Value support
1 parent 2160207 commit 1f8ea14

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
@@ -140,9 +140,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
140140
"lookup.tests.LookupQueryingTests.test_filter_exists_lhs",
141141
# QuerySet.alias() doesn't work.
142142
"lookup.tests.LookupQueryingTests.test_alias",
143-
# Value() not supported.
144-
"lookup.tests.LookupQueryingTests.test_annotate_literal_greater_than_field",
145-
"lookup.tests.LookupQueryingTests.test_annotate_value_greater_than_value",
146143
# annotate() with combined expressions doesn't work:
147144
# 'WhereNode' object has no attribute 'field'
148145
"lookup.tests.LookupQueryingTests.test_combined_annotated_lookups_in_filter",

0 commit comments

Comments
 (0)