title: Creating a mongodb query in Java with $or and $in
body: <p>I am trying to write a java code using mongodb api to create this mongodb query:</p>
  
  <pre><code>{ "$or": [{"prd" : {"$in" : ["1234", "0987"]}} , {"rsin" : "3228742"}]}
  </code></pre>
  
  <p>Here's the code I am working with so far:</p>
  
  <pre><code>QueryBuilder builder = new QueryBuilder();
  
  if (builder == null) {
      builder = QueryBuilder.start();
   }
  
  if (mongoKey.equals("prd")){
  
       ArrayList&lt;String&gt; vals = new ArrayList&lt;String&gt;();
  
       for (int i=0; i &lt; prdList; i++){
           vals.add(prdList.get(i));
       }
  
       DBObject obj = new BasicDBObject (mongoKey, new BasicDBObject("$in", vals));
       builder.or(obj);
  
  }else {
        builder.and(mongoKey).is(mongoValue);
  }
  </code></pre>
  
  <p>This is currently printing out the wrong syntax:</p>
  
  <pre><code>{ "$or": [{"prd" : {"$in" : ["1234", "0987"]}}] , "rsin" : "3228742"}
  </code></pre>
  
  <p>Any help?</p>