// Get an instance of Mongo
Mongo m = new Mongo("localhost", 27017);
DB db = m.getDB("personDB");
personCollection = db.getCollection("persons");
if (personCollection == null) {
personCollection = db.createCollection("persons", null);
}
} catch (UnknownHostException ex) {
Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex);
}
}