From f0eec458364ebd3c3db08d66dde8db7f72a4cbc6 Mon Sep 17 00:00:00 2001 From: pb Date: Tue, 16 Jul 2024 10:56:42 +0200 Subject: [PATCH] mongo --- mongo.go | 60 -------------------------------------------------------- 1 file changed, 60 deletions(-) diff --git a/mongo.go b/mongo.go index c558633..e0681b6 100644 --- a/mongo.go +++ b/mongo.go @@ -16,13 +16,6 @@ var ( mngoClient *mongo.Client mngoDB *mongo.Database MngoCtx context.Context - - MngoCollData *mongo.Collection - MngoCollComputing *mongo.Collection - MngoCollStorage *mongo.Collection - MngoCollDatacenter *mongo.Collection - MngoCollWorkspace *mongo.Collection - MngoCollSchedule *mongo.Collection ) // Trying to get vscode to display this @@ -51,11 +44,6 @@ func MongoInit() { DBname = conf["DCNAME"] + "-" + conf["DBPOINT"] - // MongoURL, err := beego.AppConfig.String(baseConfig + "::url") - // if err != nil { - // logger.Critical().Msg("MongoDB URI error: %v", err) - // panic(err) - // } logger.Info().Msg("Connecting to" + MongoURL) MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second) @@ -105,13 +93,6 @@ func prepareDB(dc_name string, db_point string) { mngoDB = mngoClient.Database(DBname) - MngoCollData = mngoDB.Collection("Data") - MngoCollComputing = mngoDB.Collection("Computing") - MngoCollStorage = mngoDB.Collection("Storage") - MngoCollDatacenter = mngoDB.Collection("Datacenter") - MngoCollWorkspace = mngoDB.Collection("Workspace") - MngoCollSchedule = mngoDB.Collection("Schedule") - list_collection := [...]string{"Data","Computing","Storage","Datacenter","Workspace","Schedule"} for _, collection_name := range(list_collection){ @@ -119,47 +100,6 @@ func prepareDB(dc_name string, db_point string) { createCollection(new_collection) } - - - - - // if _, err = MngoCollComputing.Indexes().CreateMany(MngoCtx, []mongo.IndexModel{ - // { - // Keys: bsonx.Doc{ - // {Key: "description", Value: bsonx.String("text")}, - // {Key: "owner", Value: bsonx.String("text")}, - // {Key: "license", Value: bsonx.String("text")}, - // }, - // }, - // }); err != nil && err.(mongo.CommandError).Code != 85 { - // logger.Critical().Msg(err) - // panic(err) - // } - - // if _, err = MngoCollStorage.Indexes().CreateMany(MngoCtx, []mongo.IndexModel{ - // { - // Keys: bsonx.Doc{ - // {Key: "name", Value: bsonx.String("text")}, - // {Key: "description", Value: bsonx.String("text")}, - // }, - // }, - // }); err != nil && err.(mongo.CommandError).Code != 85 { - // logger.Critical().Msg(err) - // panic(err) - // } - - // if _, err = MngoCollDatacenter.Indexes().CreateMany(MngoCtx, []mongo.IndexModel{ - // { - // Keys: bsonx.Doc{ - // {Key: "name", Value: bsonx.String("text")}, - // {Key: "description", Value: bsonx.String("text")}, - // {Key: "owner", Value: bsonx.String("text")}, - // }, - // }, - // }); err != nil && err.(mongo.CommandError).Code != 85 { - // logger.Critical().Msg(err) - // panic(err) - // } } func createCollection(new_collection *mongo.Collection) {