上传索引代码

This commit is contained in:
liwei1dao 2022-12-15 14:08:01 +08:00
parent 39d46f3a01
commit 0bf03f4d44

View File

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