Example usage for com.mongodb Mongo Mongo

List of usage examples for com.mongodb Mongo Mongo

Introduction

In this page you can find the example usage for com.mongodb Mongo Mongo.

Prototype

Mongo(final MongoClientURI mongoURI) 

Source Link

Usage

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;
}