Example usage for com.mongodb MongoURI MONGODB_PREFIX

List of usage examples for com.mongodb MongoURI MONGODB_PREFIX

Introduction

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

Prototype

String MONGODB_PREFIX

To view the source code for com.mongodb MongoURI MONGODB_PREFIX.

Click Source Link

Document

The prefix for mongodb URIs.

Usage

From source file:org.mule.module.mongo.MongoCloudConnector.java

License:Open Source License

private MongoClientURI getMongoClientURI(final String username, final String password, final String database) {
    List<String> hostsWithPort = new LinkedList<String>();
    for (String hostname : host.split(",\\s?")) {
        hostsWithPort.add(hostname + ":" + port);
    }/*from  w  w  w .j a v a  2  s. c  o m*/
    return new MongoClientURI(MongoURI.MONGODB_PREFIX +
    //                        username + ":" + password + "@" +
            StringUtils.join(hostsWithPort, ",") + "/" + database, getMongoOptions(database));
}