title: Is there a way to render a BasicDBObject into Map<String,String> with MongoDB/Java?
body: <p>Is there a way to render a <code>BasicDBObject</code> into <code>Map&lt;String,String&gt;</code> with MongoDB/Java?</p>
  
  <pre><code>public Map&lt;String,String&gt; getObjectByKeyValue(String dbname, String collname, String key, String value) {
  
      Map&lt;String,String&gt; result = new HashMap&lt;String, String&gt;();
  
      DB db = mongo.getDB(dbname);
      DBCollection coll = db.getCollection(collname);
  
      BasicDBObject query = new BasicDBObject();
      query.put(key, value);
      DBCursor cur = coll.find(query);
      while (cur.hasNext()){
          DBObject obj = (DBObject) cur.next(); // Correct, or use BasicDBObject?
          // How to get each pair stored in the object be pushed into a Map&lt;String,String&gt; ?
      }
      return result;
  }
  </code></pre>