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

lookup between local (single)value in every object and foreign (single) value and i got an empty array

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Done
    • Affects Version/s: 3.6.1
    • Fix Version/s: None
    • Component/s: JavaScript
    • Labels:
      None

      Description

      db.Tasks.aggregate([ {
      $lookup:

      { from: "Userdata", localField: "customer_id", foreignField: "_id", as: "userdetails" }

      } ]

      here i get the empty array of userdetails .
      please check i gave the response below.
      response:
      [

      { "_id": "5a6ecde19f3a0d31f4cd5b5e", "executive_id": "5a6ec6879a3e3406f8f7d70b", "customer_id": "5a5495b1a03790158019a7d5", "task_completed": false, "__v": 0, "userdeatails": [] }

      ,

      { "_id": "5a6ecdf29f3a0d31f4cd5b5f", "executive_id": "5a6ec6879a3e3406f8f7d70b", "customer_id": "5a5495b1a03790158019a7d5", "task_completed": false, "__v": 0, "userdeatails": [] }

      ,

      { "_id": "5a6ece0d9f3a0d31f4cd5b60", "executive_id": "5a6ec6879a3e3406f8f7d70b", "customer_id": "5a67055d611e836db9078ca3", "task_completed": false, "__v": 0, "userdeatails": [] }

      ,

      { "_id": "5a6ed8829f3a0d31f4cd5b61", "executive_id": "5a6ec822c2eee725f8282b3c", "customer_id": "5a67055d611e836db9078ca3", "task_completed": false, "__v": 0, "userdeatails": [] }

      ]

        Attachments

        1. tasks.png
          tasks.png
          152 kB
        2. userdata.png
          userdata.png
          7 kB

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: