Skip to content

Commit

Permalink
feat: bcs-common mongodb支持配置replicaset (#3632)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyudeqiu authored Dec 12, 2024
1 parent 31c9cf9 commit 8ecf67f
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 8ecf67f

Please sign in to comment.