mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-06 01:55:58 +08:00
groupdb
This commit is contained in:
@@ -13,7 +13,17 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func InitMongoClient() *mongo.Client {
|
||||
type Client struct {
|
||||
mongo *mongo.Client
|
||||
}
|
||||
|
||||
func NewMongoClient() *Client {
|
||||
var client Client
|
||||
client.mongo = initMongo()
|
||||
return &client
|
||||
}
|
||||
|
||||
func initMongo() *mongo.Client {
|
||||
uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority"
|
||||
if config.Config.Mongo.DBUri != "" {
|
||||
// example: mongodb://$user:$password@mongo1.mongo:27017,mongo2.mongo:27017,mongo3.mongo:27017/$DBDatabase/?replicaSet=rs0&readPreference=secondary&authSource=admin&maxPoolSize=$DBMaxPoolSize
|
||||
|
||||
Reference in New Issue
Block a user