title: Find entry without a cursor in mongodb?
body: <p>Im using mongodb and java. There is a function login, this function is checking the db for a mail and fit password. If there is no one then return false, if yes then true:</p>
  
  <pre><code>boolean login(String email, String password) {
  
      /**/
  
      BasicDBObject query = new BasicDBObject();
      query.put("email", email);
      query.put("password", password);
  
      DBCollection collection = c.getDatabase().getCollection("...");
      DBCursor cursor = collection.find(query);
  
      if (cursor.size() &gt; 0)
          return true;
      return false;
  }
  </code></pre>
  
  <p>I have the feeling that this function looks ugly ^^ Is there a better way to code this in java? Avoid a curos? Well its working but there could be a better way as <code>cursor.size()</code> Thank you</p>