title: Can't access sub array fields in $map
body: <p>I have an object like so</p>
  <pre><code>{
        &quot;_id&quot;: &quot;62334a3c86f03ce0985f11a1&quot;,
        &quot;stops&quot;: [
          {
            &quot;location&quot;: {
              &quot;baseLocation&quot;: &quot;622e29bd0a56c69f81e0e6e9&quot;,
              &quot;extraLocation&quot;: &quot;622e29bd0a56c69f81e0e6eb&quot;
            },
            &quot;timesData&quot;: [
              {
                &quot;wType&quot;: &quot;date&quot;
              }
            ],
          },
          {
            &quot;location&quot;: {
              &quot;baseLocation&quot;: &quot;622e70a59975be022276178c&quot;,
              &quot;extraLocation&quot;: &quot;622e70a59975be022276178e&quot;
            },
            &quot;timesData&quot;: [
              {
                &quot;wType&quot;: &quot;date&quot;
              }
            ],
            }
          },
        ],
      }
  </code></pre>
  <p>I need to find the index of objects that have a <code>baseLocation</code> equal to a value and which have a <code>wType</code> of <code>date</code> and I do so using a <code>$map</code> like the one below</p>
  <pre><code>  {
      $map: {
        input: &quot;$stops&quot;,
        in: {
          $and: [
            {
              $eq: [&quot;$$this.location.baseLocation&quot;, mongoose.Types.ObjectId(from.id)]
            },
            {
              $eq: [&quot;$$this.timesData.0.wType&quot;, &quot;date&quot;]
            }
          ]
        }
      }
    },
  </code></pre>
  <p>I get no matches, but if I do it like this</p>
  <pre><code>  {
      $map: {
        input: &quot;$stops&quot;,
        in: {
              $eq: [&quot;$$this.location.baseLocation&quot;, mongoose.Types.ObjectId(from.id)]
        }
      }
    },
  </code></pre>
  <p>It works, so I guess the problem is that I can't access <code>&quot;$$this.timesData.0.wType&quot;</code></p>