Skip to content

Commit

Permalink
refactor: remove usage of go.mongodb.org/mongo-driver/x/bsonx package (
Browse files Browse the repository at this point in the history
…#297)

This package is gone after mongodb/mongo-go-driver#1122,
which is included in mongo-go-driver v1.12.0. Replace the only usage
site with the better supported equivalent.
  • Loading branch information
xen0n authored Jul 5, 2023
1 parent ec9b0af commit 5d875cc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"go.mongodb.org/mongo-driver/bson/bsoncodec"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/x/bsonx"
)

// Collection is a handle to a MongoDB collection
Expand Down Expand Up @@ -434,12 +433,12 @@ func (c *Collection) ensureIndex(ctx context.Context, indexes []opts.IndexModel)
var indexModels []mongo.IndexModel
for _, idx := range indexes {
var model mongo.IndexModel
var keysDoc bsonx.Doc
var keysDoc bson.D

for _, field := range idx.Key {
key, n := SplitSortField(field)

keysDoc = keysDoc.Append(key, bsonx.Int32(n))
keysDoc = append(keysDoc, bson.E{Key: key, Value: n})
}
model = mongo.IndexModel{
Keys: keysDoc,
Expand Down

0 comments on commit 5d875cc

Please sign in to comment.