|
@@ -8,6 +8,7 @@ import (
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
|
"go.mongodb.org/mongo-driver/event"
|
|
|
mgoptions "go.mongodb.org/mongo-driver/mongo/options"
|
|
|
+ "go.mongodb.org/mongo-driver/mongo/writeconcern"
|
|
|
"sync"
|
|
|
)
|
|
|
|
|
@@ -78,7 +79,9 @@ func MgoNewClient(mgoConfig MgoConfig) *qmgo.Client {
|
|
|
}
|
|
|
|
|
|
// 创建options
|
|
|
- ops := options.ClientOptions{ClientOptions: &mgoptions.ClientOptions{}}
|
|
|
+ ops := options.ClientOptions{ClientOptions: &mgoptions.ClientOptions{
|
|
|
+ WriteConcern: &writeconcern.WriteConcern{W: "majority"},
|
|
|
+ }}
|
|
|
ops.SetMonitor(cmdMonitor)
|
|
|
|
|
|
ctx := context.Background()
|