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

Implement creating the final object for $lookup lowered into SBE

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 6.0.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • QE 2022-04-04, QE 2022-02-21, QE 2022-03-07, QE 2022-03-21
    • 162

    Description

      This final stage is likely to be the same for all types of joins (NLJ, INLJ and HJ).

      Be careful re paths in "as" field. The expected semantics are:

      db.left.drop(); db.right.drop();
      db.left.insertMany([
          { "a":1, "obj" : {b: 2 } }, 
          { "a":1, "obj" : {b: 2 } },
      ])
      db.right.insertMany([
          { "z": 1},
      ])
      > db.left.aggregate([{$lookup: {from: "right", localField: "a", foreignField: "z", as: "obj", pipeline: [{$project:{_id:0}}]}},{$project:{_id:0}}])
      { "a" : 1, "obj" : [ { "z" : 1 } ] }
      { "a" : 1, "obj" : [ { "z" : 1 } ] }
      > db.left.aggregate([{$lookup: {from: "right", localField: "a", foreignField: "z", as: "obj.b", pipeline: [{$project:{_id:0}}]}},{$project:{_id:0}}])
      { "a" : 1, "obj" : { "b" : [ { "z" : 1 } ] } }
      { "a" : 1, "obj" : { "b" : [ { "z" : 1 } ] } }
      > db.left.aggregate([{$lookup: {from: "right", localField: "a", foreignField: "z", as: "obj.obj", pipeline: [{$project:{_id:0}}]}},{$project:{_id:0}}])
      { "a" : 1, "obj" : { "b" : 2, "obj" : [ { "z" : 1 } ] } }
      { "a" : 1, "obj" : { "b" : 2, "obj" : [ { "z" : 1 } ] } }
      

      And for paths with numeric components, these are treated as field names rather than indices into arrays.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: