title: not able to insert documents into collection using mongodb java driver
body: <p>I'm using mongo mongo java driver version 2.11.2. I want to insert some few documents into my dbin mongodb and when I try to do it from command line it all works fine. But when I use mongo java driver, it is not working. I'm using <code>BasicDBObject</code> to populate the document. But <code>collection.insert(BasicDBObject).getN()</code> gives me 0 always. Nothing is getting inserted into the collection. Am I missing something here?</p>
  
  <p>Adding the code:</p>
  
  <pre><code>mongo = new MongoClient("localhost", 27017);
  DB db = mongo.getDB("db");
  DBCollection collection = db.getCollection("collection");
  BasicDBObject o = new BasicDBObject();
  o.put("key1", "value1");
  o.put("key2", "value2");
  collection.insert(o);
  </code></pre>
  
  <p>No update is made in DB after this.</p>