-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
-
ALL
-
-
None
-
None
-
None
-
None
-
None
-
None
-
None
A $lookup can fail under join optimization when its `as` field has the same prefix as a local path referenced through `let` in the sub-pipeline's $expr.
The optimizer adds the foreign node to the PathResolver before resolving the `let` RHS. If the lookup uses `as: "X"` and the local side references `"$X.y"`, that path is resolved as a foreign path instead of the local document path. The resulting equality predicate connects the foreign node to itself and triggers the "Self edges are not permitted" tassert while adding the join edge.
Without join optimization, $lookup correctly evaluates `"$X.y"` on the local document and returns the expected result.
- is related to
-
SERVER-126379 Implicit edge generation can create self-edge
-
- Closed
-