if (connectionSpec.getWriteConcern() != null) {
db.setWriteConcern(connectionSpec.getWriteConcern());
}
} catch (Exception exception) {
ResourceException resourceException = new ResourceException(exception.toString());
resourceException.initCause(exception);
throw resourceException;
}
}
return new MongoConnection(db, isExternal, connectionSpec);