title: MongoDB Aggregration Framework and Java Driver making $or condtion work
body: <p>I am working on a method that queries a mongoDB using the aggregator framework.  I have built up the aggregate but I keep getting the following exception:</p>
  
  <blockquote>
    <p>Pipeline::run(): unrecognized pipeline op \"$or"</p>
  </blockquote>
  
  <p>If I understand correctly when you append or add DBObjects to the query they are implicitly added as and operations.  I may be really tired right now but I can't think of a way to or two conditions with the aggregation framework.</p>
  
  <p>The following is a snippet of my code:</p>
  
  <pre><code>    DBObject matchCriteriaTransmitter = new BasicDBObject("$match",
              new BasicDBObject("someKey": "someValue").
                      append("someKey": "someValue"));
  
      DBObject matchCriteriaReceiver = new BasicDBObject("$match",
              new BasicDBObject("someKey": "someValue").
                      append("someKey": "someValue"));
  
      BasicDBList or = new BasicDBList();
      or.add(matchCriteriaTransmitter);
      or.add(matchCriteriaReceiver);
  
      DBObject matchCriteria = new BasicDBObject("$or", or);
  
      DBObject sortCriteria = new BasicDBObject("$sort",
              new BasicDBObject("compoundIndex.scenarioDtg", -1));
  
      DBObject limitCriteria = new BasicDBObject("$limit", 1);
  
  
      DBCollection collection = dao.getCollection();
  
      AggregationOutput output = collection.aggregate(matchCriteria, sortCriteria, limitCriteria);
  </code></pre>
  
  <p>Any insight is greatly appreciated!</p>