Skip to content

Commit

Permalink
Update options and remove exposed x in mongo
Browse files Browse the repository at this point in the history
GODRIVER-793
GODRIVER-747
GODRIVER-727

Change-Id: I5e057598d5e425f6b9837af2a1d08a122b7f00fc
  • Loading branch information
skriptble committed Feb 19, 2019
1 parent 4934d52 commit 32946b1
Show file tree
Hide file tree
Showing 46 changed files with 1,774 additions and 859 deletions.
3 changes: 2 additions & 1 deletion benchmark/single.go
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/mongodb/mongo-go-driver/internal/testutil"
"github.com/mongodb/mongo-go-driver/mongo"
"github.com/mongodb/mongo-go-driver/mongo/options"
"github.com/mongodb/mongo-go-driver/x/bsonx"
)

Expand All @@ -27,7 +28,7 @@ func getClientDB(ctx context.Context) (*mongo.Database, error) {
if err != nil {
return nil, err
}
client, err := mongo.NewClient(cs.String())
client, err := mongo.NewClient(options.Client().ApplyURI(cs.String()))
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion examples/documentation_examples/examples_test.go
Expand Up @@ -16,12 +16,13 @@ import (
"github.com/mongodb/mongo-go-driver/examples/documentation_examples"
"github.com/mongodb/mongo-go-driver/internal/testutil"
"github.com/mongodb/mongo-go-driver/mongo"
"github.com/mongodb/mongo-go-driver/mongo/options"
"github.com/stretchr/testify/require"
)

func TestDocumentationExamples(t *testing.T) {
cs := testutil.ConnString(t)
client, err := mongo.Connect(context.Background(), cs.String(), nil)
client, err := mongo.Connect(context.Background(), options.Client().ApplyURI(cs.String()))
require.NoError(t, err)

db := client.Database("documentation_examples")
Expand Down
8 changes: 6 additions & 2 deletions mongo/change_stream.go
Expand Up @@ -104,7 +104,11 @@ func createCmdDocs(csType StreamType, opts *options.ChangeStreamOptions, registr
cursorDoc = cursorDoc.Append("batchSize", bsonx.Int32(*opts.BatchSize))
}
if opts.Collation != nil {
optsDoc = optsDoc.Append("collation", bsonx.Document(opts.Collation.ToDocument()))
collDoc, err := bsonx.ReadDoc(opts.Collation.ToDocument())
if err != nil {
return nil, nil, nil, nil, err
}
optsDoc = optsDoc.Append("collation", bsonx.Document(collDoc))
}
if opts.FullDocument != nil {
pipelineDoc = pipelineDoc.Append("fullDocument", bsonx.String(string(*opts.FullDocument)))
Expand All @@ -131,7 +135,7 @@ func createCmdDocs(csType StreamType, opts *options.ChangeStreamOptions, registr

func getSession(ctx context.Context, client *Client) (Session, error) {
sess := sessionFromContext(ctx)
if err := client.ValidSession(sess); err != nil {
if err := client.validSession(sess); err != nil {
return nil, err
}

Expand Down

0 comments on commit 32946b1

Please sign in to comment.