-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
-
Fully Compatible
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The Join ordering project needs to be able to map the foreignField name to the name at the output of the subpipeline.
Example from alya.berciu@mongodb.com:
[
{$lookup: {from: "A", localField: "a", foreignField: "b", as: "fromA", pipeline: [
{$project: {renamedField: "$b"}}
]}},
{$unwind: "$fromA"}
]
When they detect that the foreignField "b" is not present in the output, they want to check if it is present under a different name, in this case "renamedField".
We can do this efficiently in the dependency graph, using the _collectionAlias side-table.
Proposed API
// returns the path under which the 'baseDocumentField' field is aliased and visible to 'stage' // tie-breaks deterministically when multiple aliases are present (not specified which one is returned). optional<string> getBaseDocumentFieldAlias( DocumentSource* stage, PathRef baseDocumentField)
- is depended on by
-
SERVER-128365 Support renames of join predicate fields
-
- Closed
-