title: Mongo aggregation with $ne
body: <p>I can't seem to find any resources at all on Mongo aggregation with the boolean operations. My query looks something like this (I am using the pymongo driver):</p>
  
  <pre><code>db.collection.aggregate([{'$match': {'foo': 3, 'bar': 'baz'}},
                            {'$project': {'quxx': 1, '_id': 0, 'count': 1}},
                            {'$group': {'total': {'$sum': '$count'}, '_id': '$quxx'}},
                            {'$sort': {'total': -1}},
                            {'$limit': 2000}])
  </code></pre>
  
  <p>Which all works great (<code>$match</code> is on an index etc). Now, there is a single rogue quxx that I would like to filter out of the pipeline so I thought that I would use the <code>$ne</code> operator. However, I can't seem to figure out the proper way to do it! I'm not sure if I'm not placing it at the right point (I want it after the <code>$match</code> operator but before the <code>$group</code> operator) or I have the syntax wrong but help would be appreciated.</p>
  
  <p>The things I have tried so far (all in their own step after <code>$match</code>) are:</p>
  
  <pre><code>{'$quxx': {'$ne': 'rogue'}}
  {'quxx': {'$ne': 'rogue'}}
  {'$ne': {'quxx': 'rogue'}}
  {'$ne': {'$quxx': 'rogue'}}
  </code></pre>
  
  <p>Every single one of them gives me <code>unrecognized pipeline op</code>.</p>