|
@@ -348,6 +348,7 @@ type MongodbSim struct {
|
|
|
UserName string
|
|
|
Password string
|
|
|
ReplSet string
|
|
|
+ Direct bool
|
|
|
}
|
|
|
|
|
|
func (m *MongodbSim) GetMgoConn() *MgoSess {
|
|
@@ -371,6 +372,9 @@ func (m *MongodbSim) Destroy() {
|
|
|
|
|
|
func (m *MongodbSim) InitPool() {
|
|
|
opts := options.Client()
|
|
|
+ if m.Direct {
|
|
|
+ opts.SetDirect(true)
|
|
|
+ }
|
|
|
registry := bson.NewRegistryBuilder().RegisterTypeMapEntry(bson.TypeArray, reflect.TypeOf([]interface{}{})).Build()
|
|
|
opts.SetRegistry(registry)
|
|
|
opts.SetConnectTimeout(3 * time.Second)
|