Skip to content

Commit

Permalink
Remove go.mongodb.org/mongo-driver/x/bsonx because it does not exis…
Browse files Browse the repository at this point in the history
…t in newer versions of mongoapi

Signed-off-by: Arrobo, Gabriel <[email protected]>
  • Loading branch information
gab-arrobo authored and dependabot[bot] committed Sep 27, 2024
1 parent d19675a commit ae837cc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mongoapi/mongoapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/x/bsonx"
)

type MongoClient struct {
Expand Down Expand Up @@ -661,7 +660,7 @@ func (c *MongoClient) CreateIndex(collName string, keyField string) (bool, error
collection := c.Client.Database(c.dbName).Collection(collName)

index := mongo.IndexModel{
Keys: bsonx.Doc{{Key: keyField, Value: bsonx.Int32(1)}},
Keys: bson.D{{Key: keyField, Value: 1}},
Options: options.Index().SetUnique(true),
}

Expand All @@ -683,7 +682,7 @@ func (c *MongoClient) CreateIndex(collName string, keyField string) (bool, error
func (c *MongoClient) RestfulAPICreateTTLIndex(collName string, timeout int32, timeField string) bool {
collection := c.Client.Database(c.dbName).Collection(collName)
index := mongo.IndexModel{
Keys: bsonx.Doc{{Key: timeField, Value: bsonx.Int32(1)}},
Keys: bson.D{{Key: timeField, Value: 1}},
Options: options.Index().SetExpireAfterSeconds(timeout).SetName(timeField),
}

Expand All @@ -708,7 +707,7 @@ func (c *MongoClient) RestfulAPIPatchTTLIndex(collName string, timeout int32, ti

//create new index with new timeout
index := mongo.IndexModel{
Keys: bsonx.Doc{{Key: timeField, Value: bsonx.Int32(1)}},
Keys: bson.D{{Key: timeField, Value: 1}},
Options: options.Index().SetExpireAfterSeconds(timeout).SetName(timeField),
}

Expand Down Expand Up @@ -767,7 +766,7 @@ func (c *MongoClient) RestfulAPIPatchOneTimeout(collName string, filter bson.M,

//create new index with new timeout
index := mongo.IndexModel{
Keys: bsonx.Doc{{Key: timeField, Value: bsonx.Int32(1)}},
Keys: bson.D{{Key: timeField, Value: 1}},
Options: options.Index().SetExpireAfterSeconds(timeout),
}

Expand Down

0 comments on commit ae837cc

Please sign in to comment.