[SERVER-64221] Paths with numeric components in foreign collections unexpectedly match to null Created: 04/Mar/22  Updated: 16/Mar/22  Resolved: 15/Mar/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Irina Yatsenko (Inactive) Assignee: Chris Harris
Resolution: Duplicate Votes: 0
Labels: mql-semantics
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-27442 Positional path component in match la... Backlog
Operating System: ALL
Participants:

 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.



 Comments   
Comment by Asya Kamsky [ 15/Mar/22 ]

See SERVER-27442 and friends.

Generated at Thu Feb 08 05:59:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.