remove cmd monitor from mongo client
This commit is contained in:
parent
efe5f2bf3e
commit
502bc1d1c4
@ -8,7 +8,6 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/event"
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
)
|
)
|
||||||
@ -28,17 +27,17 @@ func Connect(ctx context.Context, deps *ConnectDeps) (*mongo.Database, error) {
|
|||||||
Host: net.JoinHostPort(deps.Configuration.Host, deps.Configuration.Port),
|
Host: net.JoinHostPort(deps.Configuration.Host, deps.Configuration.Port),
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdMonitor := &event.CommandMonitor{
|
//cmdMonitor := &event.CommandMonitor{
|
||||||
Started: func(_ context.Context, evt *event.CommandStartedEvent) {
|
// Started: func(_ context.Context, evt *event.CommandStartedEvent) {
|
||||||
log.Println(evt.Command)
|
// log.Println(evt.Command)
|
||||||
},
|
// },
|
||||||
Succeeded: func(_ context.Context, evt *event.CommandSucceededEvent) {
|
// Succeeded: func(_ context.Context, evt *event.CommandSucceededEvent) {
|
||||||
log.Println(evt.Reply)
|
// log.Println(evt.Reply)
|
||||||
},
|
// },
|
||||||
Failed: func(_ context.Context, evt *event.CommandFailedEvent) {
|
// Failed: func(_ context.Context, evt *event.CommandFailedEvent) {
|
||||||
log.Println(evt.Failure)
|
// log.Println(evt.Failure)
|
||||||
},
|
// },
|
||||||
}
|
//}
|
||||||
|
|
||||||
connectionOptions := options.Client().
|
connectionOptions := options.Client().
|
||||||
ApplyURI(mongoURI.String()).
|
ApplyURI(mongoURI.String()).
|
||||||
@ -47,8 +46,7 @@ func Connect(ctx context.Context, deps *ConnectDeps) (*mongo.Database, error) {
|
|||||||
AuthSource: deps.Configuration.Auth,
|
AuthSource: deps.Configuration.Auth,
|
||||||
Username: deps.Configuration.User,
|
Username: deps.Configuration.User,
|
||||||
Password: deps.Configuration.Password,
|
Password: deps.Configuration.Password,
|
||||||
}).
|
})
|
||||||
SetMonitor(cmdMonitor)
|
|
||||||
|
|
||||||
ticker := time.NewTicker(1 * time.Second)
|
ticker := time.NewTicker(1 * time.Second)
|
||||||
timeoutExceeded := time.After(deps.Timeout)
|
timeoutExceeded := time.After(deps.Timeout)
|
||||||
|
Loading…
Reference in New Issue
Block a user