diff --git a/config/config.yaml b/config/config.yaml index 8b8b3225d..43421630d 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -28,7 +28,7 @@ mysql: mongo: dbUri: ""#当dbUri值不为空则直接使用该值 #dbAddress: 127.0.0.1:37017 #单机时为mongo地址,使用分片集群时,为mongos地址 默认即可 - dbAddress: [127.0.0.1:37017] #单机时为mongo地址,使用分片集群时,为mongos地址 默认即可 + dbAddress: [ 127.0.0.1:37017 ] #单机时为mongo地址,使用分片集群时,为mongos地址 默认即可 dbDirect: false dbTimeout: 60 dbDatabase: openIM #mongo db 默认即可 diff --git a/pkg/common/db/model.go b/pkg/common/db/model.go index c5e2349fe..979609325 100644 --- a/pkg/common/db/model.go +++ b/pkg/common/db/model.go @@ -72,7 +72,7 @@ func init() { // clientOpts := options.Client().ApplyURI("mongodb://localhost:27017,localhost:27018/?replicaSet=replset") //mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]] //uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin&replicaSet=replset", - uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin", + uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin&replicaSet=replset", config.Config.Mongo.DBUserName, config.Config.Mongo.DBPassword, mongodbHosts, config.Config.Mongo.DBDatabase, config.Config.Mongo.DBMaxPoolSize) } else {