We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03b7c93 commit 3a9d30cCopy full SHA for 3a9d30c
django_mongodb_backend/compiler.py
@@ -625,7 +625,10 @@ def get_combinator_queries(self):
625
fields[expr.alias] = 1
626
else:
627
fields[alias] = f"${ref}" if alias != ref else 1
628
- inner_pipeline.append({"$project": fields})
+ # Avoid duplicating the same $project stage
629
+ # when reusing subquery projections.
630
+ if not inner_pipeline or inner_pipeline[-1] != {"$project": fields}:
631
+ inner_pipeline.append({"$project": fields})
632
# Combine query with the current combinator pipeline.
633
if combinator_pipeline:
634
combinator_pipeline.append(
0 commit comments