title: MongoDB aggregate returning only specific fields
body: <p>I have the following code:</p>
  <pre><code>const profiles = await Profile.aggregate([
        {
          $lookup: {
            from: &quot;users&quot;,
            localField: &quot;user&quot;,
            foreignField: &quot;_id&quot;,
            as: &quot;user&quot;,
          },
        },
        {
          $unwind: &quot;$user&quot;,
        },
        {
          $match: {
            &quot;user.name&quot;: {
              $regex: q.trim(),
              $options: &quot;i&quot;,
            },
          },
        },
        {
          $skip: req.params.page ? (req.params.page - 1) * 10 : 0,
        },
        {
          $limit: 11,
        },
        {
          $group: {
            _id: &quot;$_id&quot;,
            skills:{skills}
            user: { name: &quot;$name&quot; },
            user: { avatar: &quot;$avatar&quot; },
          },
        },
      ]);
  </code></pre>
  <p>I want to return only specific fields like skills _id and user.name and user.avatar, but this doesn't work. I'm pretty sure that the problem is in $group. I want to receive only these fields</p>
  <pre><code> [
     {
       _id: 5ef78d005d23020ca847aa76,
       skills: [ 'asd' ],
       user: {
         _id: 5ef78c7c5d23020ca847aa75,
         name: 'Simeon Lazarov',
         avatar: 'uploads\\1593286096227 - background.jpg',
       }
     }
   ]
  </code></pre>