Skip to content

Commit dc56fd9

Browse files
committed
support resolve_inner_expression in aggregates.
1 parent 93ee4b8 commit dc56fd9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

django_mongodb/aggregates.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@
1010
MONGO_AGGREGATIONS = {Count: "sum"}
1111

1212

13-
def aggregate(self, compiler, connection, operator=None, **extra_context): # noqa: ARG001
13+
def aggregate(
14+
self,
15+
compiler,
16+
connection,
17+
operator=None,
18+
resolve_inner_expression=False,
19+
**extra_context, # noqa: ARG001
20+
):
1421
if self.filter:
1522
node = self.copy()
1623
node.filter = None
@@ -20,6 +27,8 @@ def aggregate(self, compiler, connection, operator=None, **extra_context): # no
2027
else:
2128
node = self
2229
lhs_mql = process_lhs(node, compiler, connection)
30+
if resolve_inner_expression:
31+
return lhs_mql
2332
operator = operator or MONGO_AGGREGATIONS.get(self.__class__, self.function.lower())
2433
return {f"${operator}": lhs_mql}
2534

0 commit comments

Comments
 (0)