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

Undefined in local matches to empty array in foreign if INLJ is used in SBE

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • QE 2022-04-18

      db.b.find()
      { "_id" : ObjectId("62477ced76646eaf6616e9e3"), "k" : undefined }
      
      db.a.find()
      { "_id" : ObjectId("62477ce276646eaf6616e9e1"), "k" : [ ] }
      
      // no index on collection "a" -- no matches on "undefined"
      db.b.aggregate({$lookup:{from:"a", localField:"k", foreignField:"k", as:"matched"}})
      { "_id" : ObjectId("62477ced76646eaf6616e9e3"), "k" : undefined, "matched" : [ ] }
      
      // after creating the index, "undefined" starts matching empty arrays
      db.a.createIndex({k:1})
      db.b.aggregate({$lookup:{from:"a", localField:"k", foreignField:"k", as:"matched"}})
      { "_id" : ObjectId("62477ced76646eaf6616e9e3"), "k" : undefined, "matched" : [ { "_id" : ObjectId("62477ce276646eaf6616e9e1"), "k" : [ ] } ] }
      

      While we've been given green light to do "whatever" for undefined, it's a little concerning that the results aren't consistent across the join types...

            Assignee:
            rui.liu@mongodb.com Rui Liu
            Reporter:
            irina.yatsenko@mongodb.com Irina Yatsenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: