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

$lookup should work right with array dot notation in localField

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.3
    • Component/s: Aggregation Framework
    • None
    • ALL
    • Hide
      Unable to find source-code formatter for language: mongodb. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      db.test.drop()
      
      db.test.insert({ "_id" : 1, "aa" : [ "bb" : { "id" : "1611e293-61c4-4028-b6fd-c5909247b020", "type": "form_charger" } ] })
      
      db.form_charger.insert({ "_id" : 1, "id" : "1611e293-61c4-4028-b6fd-c5909247b020" })
      
      db.test.aggregate([{ '$lookup': { from: 'form_charger', localField: 'aa.0.bb.id', foreignField: 'id', as: 'data_bb' } }])
      
      

      The result of *data_bb* always empty.

      Show
      Unable to find source-code formatter for language: mongodb. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml db.test.drop() db.test.insert({ "_id" : 1, "aa" : [ "bb" : { "id" : "1611e293-61c4-4028-b6fd-c5909247b020" , "type" : "form_charger" } ] }) db.form_charger.insert({ "_id" : 1, "id" : "1611e293-61c4-4028-b6fd-c5909247b020" }) db.test.aggregate([{ '$lookup' : { from: 'form_charger' , localField: 'aa.0.bb.id' , foreignField: 'id' , as: 'data_bb' } }]) The result of * data_bb * always empty.

      The $lookup stages now not work with dot notation when the path point into an embedded array.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            futurist Jame Yang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: