title: How to use MongoDB aggregate to look up an ARRAY of objects with NESTED OBJECT
body: <p>I am currently searching MongoDB to find all the Posts and showing all the COMMENTS array. Each COMMENT has a postedBy nested object ID that refers to the USERS model.</p>
  <p>At the moment when I $lookup, I loose all my current data. I wasnt to keep the initial data but then add on the details about the postedBy.</p>
  <p>Similar to what population would do on a Post.find().</p>
  <pre><code>        const bigPosts= await Post.aggregate([
  //Code works good 
              {
          $addFields: {
            winAmount: {
              $round: { $multiply: ['$betAmount', '$odds'] },
                   },
                 },
               },
             {
              $lookup: {
                from: 'users',
                localField: 'postedBy',
                foreignField: '_id',
                as: 'postedBy',
              },
            },
            {
              $unwind: { path: '$postedBy', preserveNullAndEmptyArrays: true },
            },
      // this is where the issues start
            {
              $lookup: {
                from: 'users',
                localField: 'comments.postedBy',
                foreignField: '_id',
                as: 'comments.postedBy',
              },
            },
            {
              $unwind: {
                path: '$comments.postedBy',
                preserveNullAndEmptyArrays: true,
              },
            },
      
            {
              $project: {
                comments: 1,
                winAmount: 1,
                'postedBy._id': 1,
                'postedBy.name': 1,
                'postedBy.username': 1,
                'postedBy.image': 1,
                 
              },
            },
          ])
  </code></pre>