title: MongoDB Java Driver creating Database and Collection
body: <p>i was testing how to create  database and collection mongo java driver.</p>
  
  <pre><code>  MongoClient client = new MongoClient("localhost",27017);
          DB db = client.getDB("ow");
          DBCollection collection = db.getCollection("documents");
          collection.save(new BasicDBObject("_id",1));
          collection.remove(new BasicDBObject("_id",1));
          boolean result = db.collectionExists("documents");
          assertTrue(result);
          assertNotNull(collection);
          client.close();
  </code></pre>
  
  <p>I would prefer to use createCollection method on the DB object, but found that it does not create database / collection unless the first document is inserted.</p>
  
  <p>My question is is this understanding correct ? Is above code correct was of creating collection or database.</p>