Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Duplicate
-
None
-
None
-
None
-
ALL
Description
db.r.find()
|
{ "_id" : 10, "a" : [ { "x" : 1 }, { "y" : 1 } ] } |
{ "_id" : 11, "a" : [ { "x" : [ 1, 2 ] } ] } |
{ "_id" : 12, "a" : [ { "x" : 1 }, { "x" : 2 } ] } |
|
db.l.find()
|
{ "_id" : 0, "b" : null } |
|
// When "r" is used as local collection, "a.0.x" doesn't match to null (expected):
|
db.r.aggregate({$lookup: {from:"l", localField:"a.0.x", foreignField:"b", as:"matched"}}) |
{ "_id" : 10, "a" : [ { "x" : 1 }, { "y" : 1 } ], "matched" : [ ] } |
{ "_id" : 11, "a" : [ { "x" : [ 1, 2 ] } ], "matched" : [ ] } |
{ "_id" : 12, "a" : [ { "x" : 1 }, { "x" : 2 } ], "matched" : [ ] } |
|
// But when "r" is used as a foreign collection, all three documents are matched to null (unexpected):
|
db.l.aggregate({$lookup: {from:"r", localField:"b", foreignField:"a.0.x", as:"matched"}}) |
{ "_id" : 0, "b" : null, "matched" : [ { "_id" : 10, "a" : [ { "x" : 1 }, { "y" : 1 } ] }, { "_id" : 11, "a" : [ { "x" : [ 1, 2 ] } ] }, { "_id" : 12, "a" : [ { "x" : 1 }, { "x" : 2 } ] } ] } |
Note: paths with numeric components aren't supported in SBE so this ticket doesn't block PM-2449, but I'm adding it to the epic for completeness.
Attachments
Issue Links
- duplicates
-
SERVER-27442 Positional path component in match language should not act as both an array index and a field name for a single document
-
- Backlog
-