title: Multiple Counts using single MONGODB group query
body: <p>I have a collection of Twitter data that I am grouping by day using MongoDB and the MongoDB PHP driver. For each grouping, I'd like to calculate two counts based on subfield data. One of the counts will be based on simply matching a string (I've figured that out). The other will be need to check if an array contains a particular string. Is there code to do the second test? </p>
  
  <p>Here's what I've got for the group() parameters:</p>
  
  <pre><code>$initial = array(
    "count" =&gt; 0,
    "mentions" =&gt; 0
  );
  
  $reduce = new MongoCode(
    "
    function (doc, prev) { 
      if (doc.interaction.interaction.author.id == $twitter_id) {
        prev.count++; 
      }
  
      //Note, only returns true if first value in array is matched. How to return true if array contains value?
      if (doc.interaction.twitter.mention_ids == $twitter_id) {
         prev.mentions++;
      }
    }
  
  ");
  </code></pre>