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

Duplicated results when INLJ is used for $lookup 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
    • None
    • Fully Compatible
    • ALL
    • QE 2022-04-04, QE 2022-04-18

      no indexes on the foreign collection "r", NLJ is used:
      db.l.aggregate({$lookup: {from:"r", localField:"b", foreignField:"a", as:"matched"}})
      { "_id" : 0,
      "b" : [ 1, 2 ],
      "matched" : [

      { "_id" : 2, "a" : [ 1, 2 ], "y" : 3 }

      ,

      { "_id" : 11, "a" : [ 2, 1 ] }

      ]
      }

      db.r.createIndex(

      {a:1}

      ) // this enables INLJ strategy for the lookup
      db.l.aggregate({$lookup: {from:"r", localField:"b", foreignField:"a", as:"matched"}})
      { "_id" : 0,
      "b" : [ 1, 2 ],
      "matched" : [

      { "_id" : 2, "a" : [ 1, 2 ], "y" : 3 }

      ,

      { "_id" : 11, "a" : [ 2, 1 ] }

      ,

      { "_id" : 2, "a" : [ 1, 2 ], "y" : 3 }

      ,

      { "_id" : 11, "a" : [ 2, 1 ] }

      ] }

            Assignee:
            nikita.lapkov@mongodb.com Nikita Lapkov (Inactive)
            Reporter:
            irina.yatsenko@mongodb.com Irina Yatsenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: