package svc import ( "github.com/globalsign/mgo" "mongo.games.com/game/dbproxy/mongo" "mongo.games.com/game/model" ) func DbCustomLogCollection(plt string) *mongo.Collection { s := mongo.MgoSessionMgrSington.GetPltMgoSession(plt, model.DbCustomLogDBName) if s != nil { d, first := s.DB().C(model.DbCustomLogCollName) if first { d.EnsureIndex(mgo.Index{Key: []string{"cycleid"}, Background: true, Sparse: true}) d.EnsureIndex(mgo.Index{Key: []string{"-startts", "cycleid"}, Background: true, Sparse: true}) d.EnsureIndex(mgo.Index{Key: []string{"roomconfigid"}, Background: true, Sparse: true}) d.EnsureIndex(mgo.Index{Key: []string{"roomid"}, Background: true, Sparse: true}) d.EnsureIndex(mgo.Index{Key: []string{"startts"}, Background: true, Sparse: true}) d.EnsureIndex(mgo.Index{Key: []string{"endts"}, Background: true, Sparse: true}) d.EnsureIndex(mgo.Index{Key: []string{"-endts"}, Background: true, Sparse: true}) } return d } return nil }