Skip to content

Commit 5bfd3f8

Browse files
committed
Handle alias_cols=False cases when resolving columns.
1 parent 2da8699 commit 5bfd3f8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

django_mongodb/expressions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ def case(self, compiler, connection):
5353
def col(self, compiler, connection): # noqa: ARG001
5454
# If the column is part of a subquery and belongs to one of the parent
5555
# queries, it will be stored for reference using $let in a $lookup stage.
56-
if (
56+
# If the query is built with `alias_cols=False`, the column is treated
57+
# as belonging to the current collection.
58+
if self.alias is not None and (
5759
self.alias not in compiler.query.alias_refcount
5860
or compiler.query.alias_refcount[self.alias] == 0
5961
):

0 commit comments

Comments
 (0)