上传好友唯一索引
This commit is contained in:
parent
753bf2a306
commit
5e6e1a24a2
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
mgooptions "go.mongodb.org/mongo-driver/mongo/options"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
@ -22,7 +23,8 @@ func (this *ModelFriend) Init(service core.IService, module core.IModule, comp c
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.moduole = module.(*Friend)
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
Options: mgooptions.Index().SetUnique(true),
|
||||
})
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "assistHeroId", Value: bsonx.Int32(1)}},
|
||||
|
Loading…
Reference in New Issue
Block a user