Skip to content

Commit f134003

Browse files
committed
fix queries where the right-hand side is a field
1 parent d5473d2 commit f134003

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

django_mongodb/features.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
138138
"lookup.tests.LookupQueryingTests.test_filter_exists_lhs",
139139
# QuerySet.alias() doesn't work.
140140
"lookup.tests.LookupQueryingTests.test_alias",
141-
# Comparing two fields doesn't work.
142-
"lookup.tests.LookupQueryingTests.test_annotate_field_greater_than_field",
143141
# Value() not supported.
144142
"lookup.tests.LookupQueryingTests.test_annotate_literal_greater_than_field",
145143
"lookup.tests.LookupQueryingTests.test_annotate_value_greater_than_value",

django_mongodb/query_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ def process_lhs(node, compiler, connection, bare_column_ref=False):
1616

1717

1818
def process_rhs(node, compiler, connection):
19+
rhs = node.rhs
20+
if hasattr(rhs, "as_mql"):
21+
return rhs.as_mql(compiler, connection)
1922
_, value = node.process_rhs(compiler, connection)
2023
lookup_name = node.lookup_name
2124
# Undo Lookup.get_db_prep_lookup() putting params in a list.

0 commit comments

Comments
 (0)