List<MongoCredential> credentials = null;
if (this.password != null && this.username != null) {
credentials = Arrays.asList(MongoCredential.createMongoCRCredential(
this.username, getMongoClientDatabase(), this.password));
}
return new MongoClient(Arrays.asList(new ServerAddress(this.host,
this.port)), credentials, options);
}
// The options and credentials are in the URI
return new MongoClient(new MongoClientURI(this.uri, builder(options)));
}