From d7dfdbcd39fbd7855c8f550344caccf91e56d093 Mon Sep 17 00:00:00 2001 From: Preston Vasquez <24281431+prestonvasquez@users.noreply.github.com> Date: Wed, 29 Nov 2023 18:06:22 -0700 Subject: [PATCH] GODRIVER-979 Fix missed context updates --- README.md | 6 +++--- examples/_logger/logrus/main.go | 2 +- examples/_logger/zap/main.go | 2 +- examples/_logger/zerolog/main.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3c13bbf962..e42143c96e 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ import ( ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() -client, err := mongo.Connect( options.Client().ApplyURI("mongodb://localhost:27017")) +client, err := mongo.Connect(options.Client().ApplyURI("mongodb://localhost:27017")) ``` Make sure to defer a call to `Disconnect` after instantiating your client: @@ -166,12 +166,12 @@ Compression can be enabled using the `compressors` parameter on the connection s ```go opts := options.Client().ApplyURI("mongodb://localhost:27017/?compressors=snappy,zlib,zstd") -client, _ := mongo.Connect(context.TODO(), opts) +client, _ := mongo.Connect(opts) ``` ```go opts := options.Client().SetCompressors([]string{"snappy", "zlib", "zstd"}) -client, _ := mongo.Connect(context.TODO(), opts) +client, _ := mongo.Connect(opts) ``` If compressors are set, the Go Driver negotiates with the server to select the first common compressor. For server configuration and defaults, refer to [`networkMessageCompressors`](https://www.mongodb.com/docs/manual/reference/program/mongod/#std-option-mongod.--networkMessageCompressors). diff --git a/examples/_logger/logrus/main.go b/examples/_logger/logrus/main.go index c75d72ccc2..7ef12c124c 100644 --- a/examples/_logger/logrus/main.go +++ b/examples/_logger/logrus/main.go @@ -39,7 +39,7 @@ func main() { ApplyURI("mongodb://localhost:27017"). SetLoggerOptions(loggerOptions) - client, err := mongo.Connect(context.TODO(), clientOptions) + client, err := mongo.Connect(clientOptions) if err != nil { log.Fatalf("error connecting to MongoDB: %v", err) } diff --git a/examples/_logger/zap/main.go b/examples/_logger/zap/main.go index ff061413f4..d7424e2e15 100644 --- a/examples/_logger/zap/main.go +++ b/examples/_logger/zap/main.go @@ -39,7 +39,7 @@ func main() { ApplyURI("mongodb://localhost:27017"). SetLoggerOptions(loggerOptions) - client, err := mongo.Connect(context.TODO(), clientOptions) + client, err := mongo.Connect(clientOptions) if err != nil { log.Fatalf("error connecting to MongoDB: %v", err) } diff --git a/examples/_logger/zerolog/main.go b/examples/_logger/zerolog/main.go index 58efe415b1..1e01f49437 100644 --- a/examples/_logger/zerolog/main.go +++ b/examples/_logger/zerolog/main.go @@ -36,7 +36,7 @@ func main() { ApplyURI("mongodb://localhost:27017"). SetLoggerOptions(loggerOptions) - client, err := mongo.Connect(context.TODO(), clientOptions) + client, err := mongo.Connect(clientOptions) if err != nil { log.Fatalf("error connecting to MongoDB: %v", err) }