I want to change library for database from github.com/mongodb/mongo-go-driver/mongo
to github.com/globalsign/mgo
, my problem is I dont know how convert this code for new library :
import "github.com/mongodb/mongo-go-driver/mongo/options"
res, err := s.totals().UpdateOne(ctx,
bson.M{"contract_id": cID, "date": date},
bson.M{"$inc": bson.M{"value": value}},
options.Update().SetUpsert(true),
)
My current code :
collection := s.totals()
err := collection.Update(
bson.M{"contract_id": contractID, "date": date},
bson.M{"$inc": bson.M{"value": value}},
//options.Update().SetUpsert(true),
)
How i can convert this options.Update().SetUpsert(true)
for use in new library ?