通过uid创建索引
This commit is contained in:
parent
43ff5abd83
commit
4e75419f38
@ -11,6 +11,8 @@ import (
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
type modelGourmet struct {
|
||||
@ -22,7 +24,10 @@ func (this *modelGourmet) Init(service core.IService, module core.IModule, comp
|
||||
this.TableName = string(comm.TableGourmet)
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.module = module.(*Gourmet)
|
||||
|
||||
// uid 创建索引
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,8 @@ import (
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
type modelSmithy struct {
|
||||
@ -22,7 +24,10 @@ func (this *modelSmithy) Init(service core.IService, module core.IModule, comp c
|
||||
this.TableName = string(comm.TableSmithy)
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.module = module.(*Smithy)
|
||||
|
||||
// uid 创建索引
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user