// Connect to replica servers if given. Else the standard way to one server.
if (replicaServers != null && replicaServers.size() > 0) {
m = new MongoClient(replicaServers, options.build());
} else {
ServerAddress address = new ServerAddress(host, port);
m = new MongoClient(address, options.build());
}
db = m.getDB(database);
db.setWriteConcern(WriteConcern.SAFE);
// Try to authenticate if configured.