mogodb url connent

pull/1232/head
dong 2 years ago
parent ed4840dd39
commit ed5a07ca18

@ -157,12 +157,12 @@ func checkMysql() error {
func checkMongo() error {
var client *mongo.Client
uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority"
defer func() {
if client != nil {
client.Disconnect(context.TODO())
}
}()
uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority"
if config.Config.Mongo.Uri != "" {
uri = config.Config.Mongo.Uri
} else {
@ -188,7 +188,6 @@ func checkMongo() error {
if err != nil {
return errs.Wrap(err)
} else {
//err = client.Ping(context.TODO(), &readpref.ReadPref{})
err = client.Ping(context.TODO(), nil)
if err != nil {
return errs.Wrap(err)

Loading…
Cancel
Save