Skip to content

Commit 9112d93

Browse files
committed
fix queries where the right-hand side is a field
1 parent 145844d commit 9112d93

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
@@ -134,8 +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-
# Comparing two fields doesn't work.
138-
"lookup.tests.LookupQueryingTests.test_annotate_field_greater_than_field",
139137
# Value() not supported.
140138
"lookup.tests.LookupQueryingTests.test_annotate_literal_greater_than_field",
141139
"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)