title: Mongoose count documents where count of array elements with property set to false is less than a value
body: <p>I have a collection where most of the documents have an array of objects, the property that I am concerned with is a boolean, and I am looking to get a count of total documents where the number of objects in the array have that property set to false, less than 10 times.</p>
  <p>The schemas are something like this</p>
  <pre><code>let MatchSchema = new Schema({
    home: {
      squad: [ SquadSchema ]
    },
    away: {
      squad: [ SquadSchema ]
    },
  });
  
  let SquadSchema = new Schema({
    check: Boolean
  });
  </code></pre>
  <p>I have been searching for a way to do this, and it looks like Aggregate is the way to go, though I am having trouble finding a solution. It looks like I can use this to get the size of each home.squad, away.squad, and the id for each document.</p>
  <pre><code>await Match.aggregate([
     {
        $project: {
           &quot;squadCountHome&quot;: {$size: &quot;$home.squad&quot;},
           &quot;squadCountAway&quot;: {$size: &quot;$away.squad&quot;},
        }
     }
  ]);
  </code></pre>
  <p>Can aggregate be used to see if the check value in squad is false less than 10 times, and more than 0?</p>