title: How to find maximum value from array inside array of objects in mongodb
body: <pre><code>{
      &quot;_id&quot;: {
          &quot;$__id&quot;: &quot;608028497a90cf06c02b1083&quot;
      },
      &quot;name&quot;: &quot;Player Unknown's Batteground Mobile&quot;,
      &quot;publisher_detail&quot;: &quot;Bluehole Corporation&quot;,
      &quot;release_date&quot;: {
          &quot;$date&quot;: &quot;2017-03-26T18:30:00.000Z&quot;
      },
      &quot;version&quot;: &quot;1.2.0&quot;,
      &quot;genre&quot;: &quot;action&quot;,
      &quot;rating&quot;: 100,
      &quot;achievement&quot;: [{
          &quot;name&quot;: &quot;Ace&quot;,
          &quot;players&quot;: [{
              &quot;player_name&quot;: &quot;notAplayer&quot;,
              &quot;score&quot;: 60,
              &quot;date_of_achievement&quot;: {
                  &quot;$date&quot;: &quot;2019-02-14T18:30:00.000Z&quot;
              },
              {
              &quot;player_name&quot;: &quot;notAplayer2&quot;,
              &quot;score&quot;: 92,
              &quot;date_of_achievement&quot;: {
                  &quot;$date&quot;: &quot;2020-04-14T18:30:00.000Z&quot;
              }
          }]
      }]
  }
  </code></pre>
  <p>I have the following mongodb schema for a gaming system.I want to write a query to find maximum score in each game. Not able to figure out what to do!</p>