title: 'like' or $regex query inside $cond in MongoDB
body: <p>Please go through this question of mine: <br>
  <a href="https://stackoverflow.com/questions/14213300/mongodb-group-and-explicit-group-formation-with-computed-column">MongoDB $group and explicit group formation with computed column</a><br></p>
  
  <p>But this time, I need to compare strings, not numbers.The <code>CASE</code> query must have a <code>LIKE</code>:<br>
  <code>
  CASE WHEN source  LIKE '%Web%'  THEN 'Web'
  </code><br><br>
  I then need to group by source. How to write this in Mongo? I am trying the following but not sure if <code>$regex</code> is supported inside <code>$cond</code>. By the way, is there a list of valid operators inside <code>$cond</code> somewhere? Looks like <code>$cond</code> isn't very fond of me :)
  <br>
  </p>
  
  <pre><code>db.Twitter.aggregate(
      { $project: { 
          "_id":0,
          "Source": {
              $cond: [
                  { $regex:['$source','/.* Android.*/'] },
                  'Android', 
                  { $cond: [
                      { $eq: ['$source', 'web'] }, 'Web', 'Others'
                  ] } 
              ]
          }
      } }
  );
  </code></pre>
  
  <p>There're many other values that I need to write in there, doing a deeper nesting. This is just an example with just 'Android' and 'Web' for the sake of brevity. I have tried both with <code>$eq</code> and <code>$regex</code>. Using <code>$regex</code> gives error of invalid operator whereas using <code>$eq</code> doesn't understand the regex expression and puts everything under 'Others'. If this is possible with regex, kindly let me know how to write it for case-insensitive match.</p>
  
  <p>Thanks for any help :-)</p>