shared peer conn

This commit is contained in:
mr
2024-08-13 09:49:42 +02:00
parent 6fe862a9b5
commit e71bd3544f
10 changed files with 237 additions and 24 deletions

View File

@@ -88,7 +88,6 @@ func (m Operator) ToMongoEOperator(k string, value interface{}) bson.E {
default:
return defaultValue
}
return defaultValue
}
func (m Operator) ToMongoOperator(k string, value interface{}) bson.M {
@@ -142,7 +141,6 @@ func (m Operator) ToMongoOperator(k string, value interface{}) bson.M {
default:
return defaultValue
}
return defaultValue
}
func StringToOperator(s string) Operator {

View File

@@ -7,6 +7,7 @@ import (
"cloud.o-forge.io/core/oc-lib/dbs"
"cloud.o-forge.io/core/oc-lib/logs"
"cloud.o-forge.io/core/oc-lib/static"
"github.com/rs/zerolog"
"go.mongodb.org/mongo-driver/bson"
@@ -104,6 +105,10 @@ func (m *MongoDB) prepareDB(list_collection []string, config MongoConf) {
new_collection := mngoDB.Collection(collection_name)
if _, exists := collectionMap[collection_name]; !exists {
m.createCollection(collection_name, new_collection)
if collection_name == "peer" {
id, p := static.GetMyLocalBsonPeer()
m.StoreOne(p, id, collection_name)
}
} else {
CollectionMap[collection_name] = new_collection
}