Skip to content

Commit 2a475b5

Browse files
committed
Fix refs and get_columns as a set.
1 parent 2987552 commit 2a475b5

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

django_mongodb/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def _get_group_expressions(self, order_by):
185185
for expr, (_, _, is_ref) in order_by:
186186
# Skip references.
187187
if not is_ref:
188-
expressions.extend(expr.get_group_by_cols())
188+
expressions |= set(expr.get_group_by_cols())
189189
having_group_by = self.having.get_group_by_cols() if self.having else ()
190190
for expr in having_group_by:
191191
expressions.add(expr)

django_mongodb/expressions.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ def raw_sql(self, compiler, connection): # noqa: ARG001
133133
raise NotSupportedError("RawSQL is not supported on MongoDB.")
134134

135135

136-
def ref(self, compiler, connection):
137-
if isinstance(self.source, Subquery):
138-
return self.source.as_mql(compiler, connection)
136+
def ref(self, compiler, connection): # noqa: ARG001
139137
prefix = (
140138
f"{self.source.alias}."
141139
if isinstance(self.source, Col) and self.source.alias != compiler.collection_name

0 commit comments

Comments
 (0)