title: adding field value from aggregation to an array
body: <p>Skill collection:</p>
  
  <pre><code>    "skillID" : "10cff2ae-76e7-455a-b1f2-07c6104d254b",
      "skillname" : "java",
      "languageID" : "84c2613c-81c3-4477-ab38-433aaef74373",
      "languagename" : "English",
      "noofendorsement" : 0
  
      "skillID" : "10cff2ae-76e7-455a-b1f2-07c6104d254b",
      "skillname" : "जावा",
      "languageID" : "hindi",
      "languagename" : "hindi",
      "noofendorsement" : 0
  
  
  
  "skillID" : "39bca1af-bea4-4a24-9f50-33992f8f8a6e",
      "skillname" : "python",
      "languageID" : "84c2613c-81c3-4477-ab38-433aaef74373",
      "languagename" : "English",
      "noofendorsement" : 0
  
  "skillID" : "39bca1af-bea4-4a24-9f50-33992f8f8a6e",
      "skillname" : "अजगर",
      "languageID" : "hindi",
      "languagename" : "hindi",
      "noofendorsement" : 0
  </code></pre>
  
  <p>Jobs collection:</p>
  
  <pre><code>    "_id" : ObjectId("5bace08ce4b022aa88870ab2"),
      "_class" : "com.citizenchat.model.Jobs",
      "userID" : "ff7f88d9-d0e5-4c10-a7b0-b9fd8b5e89eb",
      "jobID" : "4d0b02b9-c508-42cb-a2c1-417f6b3d422b",
      "jobProfile" : "Legislators",
      "lastDate" : "29-09-2018",
      "jobEndDateMilliSeconds" : NumberLong(1538245799999),
      "jobEndDate" : ISODate("2018-09-29T18:29:59.999Z"),
      "jobstatus" : "Expired",
      "jobType" : "Fulltime",
      "jobDescription" : "Job",
      "postingDate" : "27-09-2018 13:52:12.787",
      "user_Skilllist" : [ 
          "10cff2ae-76e7-455a-b1f2-07c6104d254b"
      ],
      "user_occupationname" : "Legislators",
      "user_occupationid" : "154bddd1-5224-47cf-b3d0-f7dfc3ae9c83",
      "jobPostDateTimeMilliseconds" : NumberLong(1538850599999),
  </code></pre>
  
  <p>i am using the following aggregation query.</p>
  
  <pre><code>db.Jobs.aggregate([
  {"$match":{"jobID":"4d0b02b9-c508-42cb-a2c1-417f6b3d422b"}},
   {
      $lookup:
         {
            from: "Skill",
            let:{"user_Skilllist":"$user_Skilllist"},
             pipeline:[
                {"$match":
                   {"$or":[
                      {"languageID":"hindi","$expr":{"$in":["$skillID","$$user_Skilllist"]}},
                      {"languageID":"84c2613c-81c3-4477-ab38-433aaef74373","$expr":{"$in":["$skillID","$$user_Skilllist"]}}
                           ]
  
                      }
  
                 },
  
            ],
            as: "skills"
        }
   },
  
  
  
  ])
  </code></pre>
  
  <p>i am getting the following result.But my requirement is
  1)i will pass the languageID to get the skills in that language only.If that my prefered langauge is not there for that skill the need to get from default langauge English.But when i pass the language id same skill which is present in different languages i am getting. </p>
  
  <p>2)After getting all the skills from aggregation.Pass all the skill names to an array.</p>
  
  <pre><code> {
      "_id" : ObjectId("5bace08ce4b022aa88870ab2"),
      "_class" : "com.citizenchat.model.Jobs",
      "userID" : "ff7f88d9-d0e5-4c10-a7b0-b9fd8b5e89eb",
      "jobID" : "4d0b02b9-c508-42cb-a2c1-417f6b3d422b",
      "jobProfile" : "Legislators",
      "lastDate" : "29-09-2018",
      "jobEndDateMilliSeconds" : NumberLong(1538245799999),
      "jobEndDate" : ISODate("2018-09-29T18:29:59.999Z"),
      "jobstatus" : "Expired",
      "jobType" : "Fulltime",
      "jobDescription" : "Job",
      "postingDate" : "27-09-2018 13:52:12.787",
      "user_Skilllist" : [ 
          "10cff2ae-76e7-455a-b1f2-07c6104d254b"
      ],
      "user_occupationname" : "Legislators",
      "user_occupationid" : "154bddd1-5224-47cf-b3d0-f7dfc3ae9c83",
      "jobPostDateTimeMilliseconds" : NumberLong(1538850599999),
  
      "skills" : [ 
          {
              "_id" : ObjectId("5ba0fbc7e4b03e2c8b8f6519"),
              "_class" : "com.citizenchat.model.Skill",
              "skillID" : "10cff2ae-76e7-455a-b1f2-07c6104d254b",
              "skillname" : "java",
              "languageID" : "84c2613c-81c3-4477-ab38-433aaef74373",
              "languagename" : "English",
              "noofendorsement" : 0
          }, 
          {
              "_id" : ObjectId("5bb47d07fc7ab61be62de768"),
              "skillID" : "10cff2ae-76e7-455a-b1f2-07c6104d254b",
              "skillname" : "जावा",
              "languageID" : "hindi",
              "languagename" : "hindi",
              "noofendorsement" : 0
          }
      ]
  }
  </code></pre>
  
  <p>I want output should be like this</p>
  
  <pre><code>"userID" : "ff7f88d9-d0e5-4c10-a7b0-b9fd8b5e89eb",
      "jobID" : "4d0b02b9-c508-42cb-a2c1-417f6b3d422b",
      "jobProfile" : "Legislators",
      "lastDate" : "29-09-2018",
      "jobEndDateMilliSeconds" : NumberLong(1538245799999),
      "jobEndDate" : ISODate("2018-09-29T18:29:59.999Z"),
      "jobstatus" : "Expired",
      "jobType" : "Fulltime",
      "jobDescription" : "Job",
      "postingDate" : "27-09-2018 13:52:12.787",
      "user_Skilllist" : [ 
          "10cff2ae-76e7-455a-b1f2-07c6104d254b"
      ],
      "user_occupationname" : "Legislators",
      "user_occupationid" : "154bddd1-5224-47cf-b3d0-f7dfc3ae9c83",
      "jobPostDateTimeMilliseconds" : NumberLong(1538850599999),
  
      "skills" : [ 
          "जावा",
           "अजगर"
      ]
  }
  </code></pre>