Skip to content

Commit 5d875cc

Browse files
authored
refactor: remove usage of go.mongodb.org/mongo-driver/x/bsonx package (#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.
1 parent ec9b0af commit 5d875cc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

collection.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"go.mongodb.org/mongo-driver/bson/bsoncodec"
2727
"go.mongodb.org/mongo-driver/mongo"
2828
"go.mongodb.org/mongo-driver/mongo/options"
29-
"go.mongodb.org/mongo-driver/x/bsonx"
3029
)
3130

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

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

442-
keysDoc = keysDoc.Append(key, bsonx.Int32(n))
441+
keysDoc = append(keysDoc, bson.E{Key: key, Value: n})
443442
}
444443
model = mongo.IndexModel{
445444
Keys: keysDoc,

0 commit comments

Comments
 (0)