Skip to content

Commit

Permalink
GODRIVER-979 Fix missed context updates
Browse files Browse the repository at this point in the history
  • Loading branch information
prestonvasquez committed Nov 30, 2023
1 parent f4eb68f commit d7dfdbc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion examples/_logger/logrus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/_logger/zap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/_logger/zerolog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit d7dfdbc

Please sign in to comment.