Răsfoiți Sursa

添加 直连 配置

wcc 2 ani în urmă
părinte
comite
b418d6181d
1 a modificat fișierele cu 2 adăugiri și 0 ștergeri
  1. 2 0
      mongodb/mongodb.go

+ 2 - 0
mongodb/mongodb.go

@@ -315,6 +315,7 @@ type MongodbSim struct {
 	Password   string
 	ReplSet    string
 	AuthSource string
+	Direct     bool //是否直连
 }
 
 func (m *MongodbSim) GetMgoConn() *MgoSess {
@@ -352,6 +353,7 @@ func (m *MongodbSim) InitPool() {
 		}
 		opts.SetAuth(cre)
 	}
+	opts.SetDirect(m.Direct)
 	/*ms := strings.Split(m.MongodbAddr, ",")
 	if m.ReplSet == "" && len(ms) > 1 {
 		m.ReplSet = "qfws"