add monitor options

This commit is contained in:
Sinh 2022-03-14 10:31:44 +07:00
parent 29e892b420
commit 47978662ca
1 changed files with 3 additions and 0 deletions

View File

@ -56,6 +56,9 @@ func Connect(cfg Config) (*mongo.Database, error) {
Password: opts.Password,
}
}
if cfg.Monitor != nil {
connectOptions.SetMonitor(cfg.Monitor)
}
// Connect
client, err := mongo.Connect(context.Background(), connectOptions.ApplyURI(cfg.Host))