Skip to content

Commit 5842349

Browse files
Bob HallBob Hall
authored andcommitted
update readme to reflect latest breaking changes to init client connections
1 parent 664a2e4 commit 5842349

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ To get started with the driver, import the `mongo` package, create a `mongo.Clie
4242
```go
4343
import "github.com/mongodb/mongo-go-driver/mongo"
4444

45-
client, err := mongo.NewClient("mongodb://localhost:27017")
45+
client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://localhost:27017"))
4646
```
4747

4848
And connect it to your running MongoDB server:
@@ -56,7 +56,7 @@ To do this in a single step, you can use the `Connect` function:
5656

5757
```go
5858
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
59-
client, err := mongo.Connect(ctx, "mongodb://localhost:27017")
59+
client, err := mongo.Connect(ctx, options.Client().ApplyURI("mongodb://localhost:27017"))
6060
```
6161

6262
Calling `Connect` does not block for server discovery. If you wish to know if a MongoDB server has been found and connected to,

0 commit comments

Comments
 (0)