title: How to query mongodb with “like” using the java api?
body: <p>this question is very similar to another <a href="https://stackoverflow.com/questions/3305561/how-to-query-mongodb-with-like">post</a></p>
  
  <p>I basically want to use the mongodb version of the sql "like" '%m%' operator</p>
  
  <p>but in my situation i'm using the java api for mongodb, while the other post is using mongodb shell</p>
  
  <p>i tried what was posted in the other thread and it worked fine </p>
  
  <pre><code>db.users.find({"name": /m/})
  </code></pre>
  
  <p>but in java, i'm using the put method on the BasicDBObject and passing it into the find() method on a DBCollections object</p>
  
  <pre><code>BasicDBObject q = new BasicDBOBject();
  q.put("name", "/"+m+"/");
  dbc.find(q);
  </code></pre>
  
  <p>but this doesn't seem to be working.  </p>
  
  <p>anyone has any ideas?</p>