-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
QE 2022-04-04, QE 2022-02-21, QE 2022-03-07, QE 2022-03-21
-
162
This final stage is likely to be the same for all types of joins (NLJ, INLJ and HJ).
Be careful re paths in "as" field. The expected semantics are:
db.left.drop(); db.right.drop(); db.left.insertMany([ { "a":1, "obj" : {b: 2 } }, { "a":1, "obj" : {b: 2 } }, ]) db.right.insertMany([ { "z": 1}, ]) > db.left.aggregate([{$lookup: {from: "right", localField: "a", foreignField: "z", as: "obj", pipeline: [{$project:{_id:0}}]}},{$project:{_id:0}}]) { "a" : 1, "obj" : [ { "z" : 1 } ] } { "a" : 1, "obj" : [ { "z" : 1 } ] } > db.left.aggregate([{$lookup: {from: "right", localField: "a", foreignField: "z", as: "obj.b", pipeline: [{$project:{_id:0}}]}},{$project:{_id:0}}]) { "a" : 1, "obj" : { "b" : [ { "z" : 1 } ] } } { "a" : 1, "obj" : { "b" : [ { "z" : 1 } ] } } > db.left.aggregate([{$lookup: {from: "right", localField: "a", foreignField: "z", as: "obj.obj", pipeline: [{$project:{_id:0}}]}},{$project:{_id:0}}]) { "a" : 1, "obj" : { "b" : 2, "obj" : [ { "z" : 1 } ] } } { "a" : 1, "obj" : { "b" : 2, "obj" : [ { "z" : 1 } ] } }
And for paths with numeric components, these are treated as field names rather than indices into arrays.