Skip to content

Commit ec0ab37

Browse files
committed
Fix unit test
1 parent b8900af commit ec0ab37

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

tests/lookup_/tests.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -137,28 +137,10 @@ def test_subquery_filter_constant(self):
137137
"let": {},
138138
"pipeline": [
139139
{"$match": {"num": {"$gt": 2}}},
140-
{
141-
"$facet": {
142-
"group": [
143-
{"$group": {"_id": None, "tmp_name": {"$addToSet": "$num"}}}
144-
]
145-
}
146-
},
147-
{
148-
"$project": {
149-
"num": {
150-
"$ifNull": [
151-
{
152-
"$getField": {
153-
"input": {"$arrayElemAt": ["$group", 0]},
154-
"field": "tmp_name",
155-
}
156-
},
157-
[],
158-
]
159-
}
160-
}
161-
},
140+
{"$group": {"_id": None, "tmp_name": {"$addToSet": "$num"}}},
141+
{"$unionWith": {"pipeline": [{"$documents": [{"tmp_name": []}]}]}},
142+
{"$limit": 1},
143+
{"$project": {"num": "$tmp_name"}},
162144
],
163145
}
164146
},

0 commit comments

Comments
 (0)