title: How to find documents matching multiple criteria
body: <p>I'm trying to query a collection using operands AND'd together. I've got the shell version working:</p>
  
  <pre><code>db.widgets.find({color: 'black, shape: 'round', weight: 100})
  </code></pre>
  
  <p>I'm unable to find the Java equivalent (using the <a href="https://api.mongodb.org/java/current/" rel="noreferrer">native driver</a>). I've tried various things, but here is my latest attempt:</p>
  
  <pre><code>// Find all black, round widgets with weight 100
  List&lt;BasicDBObject&gt; criteria = new ArrayList&lt;BasicDBObject&gt;();
  criteria.add(new BasicDBObject("color", "black"));
  criteria.add(new BasicDBObject("shape", "round"));
  criteria.add(new BasicDBObject("weight", 100));
  
  DBCursor cur = widgets.find(new BasicDBObject("$and", criteria));
  
  // Get all matching widgets and put them into a list
  List&lt;Widget&gt; widgetList = new ArrayList&lt;Widget&gt;();
  DBCursor cur = widgets.find(andQuery);
  while (cur.hasNext()) {
    widgetList.add(new Widget(cur.next()));
  }
  
  if (widgetList.isEmpty())
    System.out.println("No results found");
  </code></pre>
  
  <p>Any ideas what is wrong?</p>