Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-64221

Paths with numeric components in foreign collections unexpectedly match to null

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • ALL

      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.

            Assignee:
            christopher.harris@mongodb.com Chris Harris
            Reporter:
            irina.yatsenko@mongodb.com Irina Yatsenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: