Skip to content

Commit 2160207

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

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
@@ -140,8 +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-
# Comparing two fields doesn't work.
144-
"lookup.tests.LookupQueryingTests.test_annotate_field_greater_than_field",
145143
# Value() not supported.
146144
"lookup.tests.LookupQueryingTests.test_annotate_literal_greater_than_field",
147145
"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)