fixed `includeCollections` parameter

This commit is contained in:
Francesco Mangiacrapa 2024-10-23 17:37:54 +02:00
parent 4d0df2de07
commit a970284fb7
1 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ import lombok.extern.slf4j.Slf4j;
public class MongoHealthCheck implements HealthCheck {
private String context;
private Boolean includeCollections;
private Boolean includeCollections = false;
public static final String SERVICE_NAME = "mongo";
/**
@ -67,7 +67,7 @@ public class MongoHealthCheck implements HealthCheck {
mongo = ImplementationProvider.get().getProvidedObjectByClass(Mongo.class);
buildHCRBuilder = appendMongoInfo(buildHCRBuilder, mongo.getConnection());
buildHCRBuilder.state(true);
if (includeCollections) {
if (includeCollections!=null && includeCollections) {
MongoIterable<String> collections = mongo.getTheClient()
.getDatabase(mongo.getConnection().getDatabase()).listCollectionNames();
log.info("listCollectionNames is null: {}", collections == null);