fixed `includeCollections` parameter
This commit is contained in:
parent
4d0df2de07
commit
a970284fb7
|
@ -28,7 +28,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
public class MongoHealthCheck implements HealthCheck {
|
public class MongoHealthCheck implements HealthCheck {
|
||||||
|
|
||||||
private String context;
|
private String context;
|
||||||
private Boolean includeCollections;
|
private Boolean includeCollections = false;
|
||||||
public static final String SERVICE_NAME = "mongo";
|
public static final String SERVICE_NAME = "mongo";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,7 +67,7 @@ public class MongoHealthCheck implements HealthCheck {
|
||||||
mongo = ImplementationProvider.get().getProvidedObjectByClass(Mongo.class);
|
mongo = ImplementationProvider.get().getProvidedObjectByClass(Mongo.class);
|
||||||
buildHCRBuilder = appendMongoInfo(buildHCRBuilder, mongo.getConnection());
|
buildHCRBuilder = appendMongoInfo(buildHCRBuilder, mongo.getConnection());
|
||||||
buildHCRBuilder.state(true);
|
buildHCRBuilder.state(true);
|
||||||
if (includeCollections) {
|
if (includeCollections!=null && includeCollections) {
|
||||||
MongoIterable<String> collections = mongo.getTheClient()
|
MongoIterable<String> collections = mongo.getTheClient()
|
||||||
.getDatabase(mongo.getConnection().getDatabase()).listCollectionNames();
|
.getDatabase(mongo.getConnection().getDatabase()).listCollectionNames();
|
||||||
log.info("listCollectionNames is null: {}", collections == null);
|
log.info("listCollectionNames is null: {}", collections == null);
|
||||||
|
|
Loading…
Reference in New Issue