Skip to content

Commit 2987552

Browse files
committed
Refs with subquery source are handled as a regular expression.
1 parent 0bda9cd commit 2987552

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
@@ -133,7 +133,9 @@ 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): # noqa: ARG001
136+
def ref(self, compiler, connection):
137+
if isinstance(self.source, Subquery):
138+
return self.source.as_mql(compiler, connection)
137139
prefix = (
138140
f"{self.source.alias}."
139141
if isinstance(self.source, Col) and self.source.alias != compiler.collection_name

0 commit comments

Comments
 (0)