上传索引错误返回

This commit is contained in:
liwei1dao 2022-12-15 14:03:06 +08:00
parent bb449d6cb9
commit cd0c174fff
6 changed files with 8 additions and 10 deletions

View File

@ -34,7 +34,7 @@ func (this *modelArena) Init(service core.IService, module core.IModule, comp co
this.MCompModel.Init(service, module, comp, opt)
this.module = module.(*Arena)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
_, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bson.A{
bsonx.Doc{
{Key: "uid", Value: bsonx.Int32(1)},

View File

@ -21,7 +21,7 @@ func (this *modelRecord) Init(service core.IService, module core.IModule, comp c
this.MCompModel.Init(service, module, comp, opt)
this.module = module.(*Arena)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
_, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return

View File

@ -12,8 +12,6 @@ import (
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
///数据组件
@ -28,9 +26,9 @@ func (this *modelBattleComp) Init(service core.IService, module core.IModule, co
this.MCompModel.Init(service, module, comp, opt)
this.module = module.(*Battle)
this.TableName = "battle"
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "heroid", Value: bsonx.Int32(1)}},
})
// _, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
// Keys: bsonx.Doc{{Key: "heroid", Value: bsonx.Int32(1)}},
// })
return
}

View File

@ -32,7 +32,7 @@ func (this *modelChatComp) Init(service core.IService, module core.IModule, comp
this.MCompModel.Init(service, module, comp, opt)
this.module = module.(*Chat)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
_, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "ruid", Value: bsonx.Int32(1)}},
})
return

View File

@ -27,7 +27,7 @@ func (this *modelEquipmentComp) Init(service core.IService, module core.IModule,
this.MCompModel.Init(service, module, comp, opt)
this.module = module.(*Equipment)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
_, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return

View File

@ -28,7 +28,7 @@ func (this *modelForumComp) Init(service core.IService, module core.IModule, com
this.module = module.(*Forum)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
_, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "heroid", Value: bsonx.Int32(1)}},
})
return