Skip to content

Commit c08dc58

Browse files
committed
Fix unit test
1 parent 4929c30 commit c08dc58

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

django_mongodb_backend/lookups.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ def get_subquery_wrapping_pipeline(self, compiler, connection, field_name, expr)
5959
"$group": {
6060
"_id": None,
6161
# use a temporal name in order to support field_name="_id"
62-
"tmp_name": {"$addToSet": expr.as_mql(compiler, connection, as_expr=True)},
62+
"subquery_results": {"$addToSet": expr.as_mql(compiler, connection, as_expr=True)},
6363
}
6464
},
6565
# Workaround for https://jira.mongodb.org/browse/SERVER-114196:
6666
# $$NOW becomes unavailable after $unionWith, so it must be stored
6767
# beforehand to ensure it remains accessible later in the pipeline.
6868
{"$addFields": {"__now": "$$NOW"}},
6969
# Add an empty extra document to handle default values on empty results.
70-
{"$unionWith": {"pipeline": [{"$documents": [{"tmp_name": []}]}]}},
70+
{"$unionWith": {"pipeline": [{"$documents": [{"subquery_results": []}]}]}},
7171
{"$limit": 1},
72-
{"$project": {field_name: "$tmp_name"}},
72+
{"$project": {field_name: "$subquery_results"}},
7373
]
7474

7575

0 commit comments

Comments
 (0)