Skip to content

bsonx.Doc need to chang to use bson.D #59

@Candy-Hixcare

Description

@Candy-Hixcare

in adaper.go

	keysDoc := bsonx.Doc{}

	for _, k := range indexes {
		keysDoc = keysDoc.Append(k, bsonx.Int32(1))
	}

	if _, err = collection.Indexes().CreateOne(
		context.Background(),
		mongo.IndexModel{
			Keys:    keysDoc,
			Options: options.Index().SetUnique(true),
		},
	); err != nil {
		return err
	}

bsonx.Doc not exist any more

https://www.mongodb.com/docs/drivers/go/current/fundamentals/indexes/

mongo document update to use bson.D

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions