diff --git a/modules/friend/model_friend.go b/modules/friend/model_friend.go index e4c2d59b0..f60c12ac2 100644 --- a/modules/friend/model_friend.go +++ b/modules/friend/model_friend.go @@ -10,6 +10,7 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/x/bsonx" ) type ModelFriend struct { @@ -21,6 +22,10 @@ func (this *ModelFriend) Init(service core.IService, module core.IModule, comp c this.TableName = comm.TableFriend err = this.MCompModel.Init(service, module, comp, options) this.moduleFriend = module.(*Friend) + this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, + }) + return } diff --git a/modules/rtask/model_record.go b/modules/rtask/model_record.go index a758a0056..e016d35b0 100644 --- a/modules/rtask/model_record.go +++ b/modules/rtask/model_record.go @@ -9,6 +9,7 @@ import ( "github.com/pkg/errors" "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/x/bsonx" ) type ModelRtaskRecord struct { @@ -22,6 +23,10 @@ func (this *ModelRtaskRecord) Init(service core.IService, module core.IModule, c err = this.MCompModel.Init(service, module, comp, options) this.moduleRtask = module.(*ModuleRtask) this.service = service + this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, + }) + return } diff --git a/modules/sociaty/model_sociaty.go b/modules/sociaty/model_sociaty.go index 92a2806c7..4c39a9244 100644 --- a/modules/sociaty/model_sociaty.go +++ b/modules/sociaty/model_sociaty.go @@ -49,6 +49,9 @@ func (this *ModelSociaty) Init(service core.IService, module core.IModule, comp this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "_id", Value: bsonx.Int32(1)}}, }) + this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "name", Value: bsonx.Int32(1)}}, + }) this.module = module.(*Sociaty) this.service = service this.EventApp = event_v2.NewApp()