title: $lookup when foreignField is in nested array
body: <p>I have two collections :  </p>
  
  <p><strong>Student</strong>  </p>
  
  <pre><code> {    
      _id: ObjectId("657..."),  
      name:'abc'
   },  
   {  
      _id: ObjectId("593..."),  
      name:'xyz'
   }
  </code></pre>
  
  <p><strong>Library</strong>  </p>
  
  <pre><code> {    
      _id: ObjectId("987..."),  
      book_name:'book1',
      issued_to: [
        {
         student: ObjectId("657...")
        },
        {
         student: ObjectId("658...")
        }
      ]
   },  
   {  
      _id: ObjectId("898..."),  
      book_name:'book2',
      issued_to: [
       {
         student: ObjectId("593...")
       },
       {
         student: ObjectId("594...")
       }
     ] 
   }
  </code></pre>
  
  <p>I want to make a Join to <strong>Student</strong> collection that exists in <strong>issued_to</strong> array of object field in <strong>Library</strong> collection.</p>
  
  <p>I would like to make a query to student collection to get the student data as well as in library collection, that will check in issued_to array if the student exists or not if exists then get the library document otherwise not. 
  I have tried $lookup of mongo 3.6 but I didn`t succeed.</p>
  
  <pre><code>db.student.aggregate([{$match:{_id: ObjectId("593...")}}, $lookup: {from: 'library', let: {stu_id:'$_id'}, pipeline:[$match:{$expr: {$and:[{"$hotlist.clientEngagement": "$$stu_id"]}}]}])
  </code></pre>
  
  <p>But it thorws error please help me in regard of this. I also looked at other questions asked at stackoverflow like. <a href="https://stackoverflow.com/questions/38954687/how-to-apply-condition-on-lookup-result-in-mongodb">question on stackoverflow</a>,
  <a href="https://stackoverflow.com/questions/47830744/mongo-3-6-aggregation-lookup-with-multiple-conditions?rq=1">question2 on stackoverflow</a> but these are comapring simple fields not array of objects. please help me</p>