title: distinct value with count and condition mongo DB
body: <p>I am new to MongoDB, and so far it seems like it is trying to go out of it's way to make doing simple things overly complex.</p>
  
  <p>I am trying to run the below MYSQL equivalent</p>
  
  <pre><code>SELECT userid, COUNT(*) 
  FROM userinfo 
  WHERE userdata like '%PC% or userdata like '%wire%' 
  GROUP BY userid
  </code></pre>
  
  <p>I have mongo version 3.0.4 and i am running MongoChef.
  I tried using something like the below:</p>
  
  <pre><code> db.userinfo.group({
  "key": {
      "userid": true
  },
  "initial": {
      "countstar": 0
  },
  "reduce": function(obj, prev) {
   prev.countstar++;
  },
  "cond": {
      "$or": [{
          "userdata": /PC/
      }, {
          "userdata": /wire/
      }]
  }
  });
  </code></pre>
  
  <p>but that did not like the OR.
  when I took out the OR, thinking I’d do half at a time and combine results in excel, i got an error "group() can't handle more than 20000 unique keys", and the result table should be much bigger than that.</p>
  
  <p>From what I can tell online, I could do this using aggregation pipelines, but I cannot find any clear examples of how to do that.</p>
  
  <p>This seems like it should be a simple thing that should be built in to any DB, and it makes no sense to me that it is not.
  Any help is much appreciated.</p>