Skip to content

Commit 32946b1

Browse files
committed
Update options and remove exposed x in mongo
GODRIVER-793 GODRIVER-747 GODRIVER-727 Change-Id: I5e057598d5e425f6b9837af2a1d08a122b7f00fc
1 parent 4934d52 commit 32946b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1774
-859
lines changed

benchmark/single.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
"github.com/mongodb/mongo-go-driver/internal/testutil"
1414
"github.com/mongodb/mongo-go-driver/mongo"
15+
"github.com/mongodb/mongo-go-driver/mongo/options"
1516
"github.com/mongodb/mongo-go-driver/x/bsonx"
1617
)
1718

@@ -27,7 +28,7 @@ func getClientDB(ctx context.Context) (*mongo.Database, error) {
2728
if err != nil {
2829
return nil, err
2930
}
30-
client, err := mongo.NewClient(cs.String())
31+
client, err := mongo.NewClient(options.Client().ApplyURI(cs.String()))
3132
if err != nil {
3233
return nil, err
3334
}

examples/documentation_examples/examples_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ import (
1616
"github.com/mongodb/mongo-go-driver/examples/documentation_examples"
1717
"github.com/mongodb/mongo-go-driver/internal/testutil"
1818
"github.com/mongodb/mongo-go-driver/mongo"
19+
"github.com/mongodb/mongo-go-driver/mongo/options"
1920
"github.com/stretchr/testify/require"
2021
)
2122

2223
func TestDocumentationExamples(t *testing.T) {
2324
cs := testutil.ConnString(t)
24-
client, err := mongo.Connect(context.Background(), cs.String(), nil)
25+
client, err := mongo.Connect(context.Background(), options.Client().ApplyURI(cs.String()))
2526
require.NoError(t, err)
2627

2728
db := client.Database("documentation_examples")

mongo/change_stream.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ func createCmdDocs(csType StreamType, opts *options.ChangeStreamOptions, registr
104104
cursorDoc = cursorDoc.Append("batchSize", bsonx.Int32(*opts.BatchSize))
105105
}
106106
if opts.Collation != nil {
107-
optsDoc = optsDoc.Append("collation", bsonx.Document(opts.Collation.ToDocument()))
107+
collDoc, err := bsonx.ReadDoc(opts.Collation.ToDocument())
108+
if err != nil {
109+
return nil, nil, nil, nil, err
110+
}
111+
optsDoc = optsDoc.Append("collation", bsonx.Document(collDoc))
108112
}
109113
if opts.FullDocument != nil {
110114
pipelineDoc = pipelineDoc.Append("fullDocument", bsonx.String(string(*opts.FullDocument)))
@@ -131,7 +135,7 @@ func createCmdDocs(csType StreamType, opts *options.ChangeStreamOptions, registr
131135

132136
func getSession(ctx context.Context, client *Client) (Session, error) {
133137
sess := sessionFromContext(ctx)
134-
if err := client.ValidSession(sess); err != nil {
138+
if err := client.validSession(sess); err != nil {
135139
return nil, err
136140
}
137141

0 commit comments

Comments
 (0)