This commit is contained in:
mr 2024-08-01 11:09:39 +02:00
parent b0f5c78e55
commit 0256266107

View File

@ -77,18 +77,18 @@ func (m *MongoDB) createClient(MongoURL string) error {
mngoClient, err = mongo.Connect(MngoCtx, clientOptions)
if err != nil {
mngoClient = nil
return errors.New("Mongodb NewClient " + MongoURL + ":" + "err")
return errors.New("Mongodb NewClient " + MongoURL + ":" + err.Error())
}
// Ping the primary
if mngoClient, err = mongo.Connect(MngoCtx, clientOptions); err != nil {
mngoClient = nil
return errors.New("Mongodb connect " + MongoURL + ":" + "err")
return errors.New("Mongodb connect " + MongoURL + ":" + err.Error())
}
if err = mngoClient.Ping(MngoCtx, nil); err != nil {
mngoClient = nil
return errors.New("Mongodb ping " + MongoURL + ":" + "err")
return errors.New("Mongodb ping " + MongoURL + ":" + err.Error())
}
return nil
}