diff --git a/dbs/mongo/mongo.go b/dbs/mongo/mongo.go index 202782c..196e399 100644 --- a/dbs/mongo/mongo.go +++ b/dbs/mongo/mongo.go @@ -47,9 +47,11 @@ func (m *MongoDB) Init(collections []string, config MongoConf) { m.Logger.Info().Msg("Connecting to" + config.GetUrl()) mngoCollections = collections mngoConfig = config - err := m.createClient(config.GetUrl()) - m.Logger.Error().Msg(err.Error()) + if err := m.createClient(config.GetUrl()); err != nil { + m.Logger.Error().Msg(err.Error()) + } } + func (m *MongoDB) createClient(MongoURL string) error { var err error // Allows us to use marshal and unmarshall with results of FindOne() and others