Skip to content

Commit

Permalink
feat: bcs-common mongodb支持配置replicaset
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyudeqiu committed Dec 11, 2024
1 parent daf7299 commit 10f70e4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bcs-common/pkg/odm/drivers/mongo/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type Options struct {
MaxPoolSize uint64
MinPoolSize uint64
Hosts []string
Replicaset string
Monitor *event.CommandMonitor
}

Expand Down Expand Up @@ -67,6 +68,9 @@ func NewDB(opt *Options) (*DB, error) {
Hosts: opt.Hosts,
Monitor: opt.Monitor,
}
if opt.Replicaset != "" {
mCliOpt.ReplicaSet = &opt.Replicaset
}
if opt.MaxPoolSize != 0 {
mCliOpt.MaxPoolSize = &opt.MaxPoolSize
}
Expand Down

0 comments on commit 10f70e4

Please sign in to comment.