From 5d875cc05ef7abe35c7baa569c75caac7b2e50ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C3=81NG=20Xu=C4=9Bru=C3=AC?= <1175567+xen0n@users.noreply.github.com> Date: Wed, 5 Jul 2023 14:03:23 +0800 Subject: [PATCH] refactor: remove usage of go.mongodb.org/mongo-driver/x/bsonx package (#297) This package is gone after https://github.com/mongodb/mongo-go-driver/pull/1122, which is included in mongo-go-driver v1.12.0. Replace the only usage site with the better supported equivalent. --- collection.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/collection.go b/collection.go index a793fad..9af5d62 100644 --- a/collection.go +++ b/collection.go @@ -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 @@ -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,