List of usage examples for com.mongodb Mongo Mongo
Mongo(final MongoClientURI mongoURI)
From source file:uk.ac.imperial.presage2.db.mongodb.MongoStorage.java
License:Open Source License
@Override public void start() throws Exception { if (!isStarted()) { this.mongo = new Mongo(this.host); this.db = this.mongo.getDB(dbName); if (this.username != "" && this.password != "") { this.db.authenticate(username, password.toCharArray()); }/*w ww. java 2 s . c om*/ } }
From source file:v7db.files.Configuration.java
License:Open Source License
public static final Mongo getMongo(Properties props) throws UnknownHostException, MongoException { MongoURI uri = new MongoURI(props.getProperty("db.uri")); Mongo mongo = new Mongo(uri); return mongo; }