timetable-extension #1
@ -152,7 +152,7 @@ func RemoveOutdatedServices(cutoff time.Time) (count int64, err error) {
|
||||
return // Automatically returns names values
|
||||
}
|
||||
|
||||
// Creates indexes on the Timetable collection
|
||||
// Creates indexes on the Timetable collection... Index suitability needs checking.
|
||||
func CreateTimetableIndexes() error {
|
||||
coll := MongoClient.Database(DatabaseName).Collection(TimetableCollection)
|
||||
indexModels := []mongo.IndexModel{
|
||||
@ -164,6 +164,24 @@ func CreateTimetableIndexes() error {
|
||||
},
|
||||
Options: options.Index().SetName("delete_query"),
|
||||
},
|
||||
{
|
||||
Keys: bson.M{
|
||||
"trainUid": 1,
|
||||
"scheduleStartDate": 1,
|
||||
"scheduleEndDate": 1,
|
||||
"daysRun": 1,
|
||||
},
|
||||
Options: options.Index().SetName("find_by_uid"),
|
||||
},
|
||||
{
|
||||
Keys: bson.M{
|
||||
"headcode": 1,
|
||||
"scheduleStartDate": 1,
|
||||
"scheduleEndDate": 1,
|
||||
"daysRun": 1,
|
||||
},
|
||||
Options: options.Index().SetName("find_by_headcode"),
|
||||
},
|
||||
}
|
||||
|
||||
_, err := coll.Indexes().CreateMany(context.Background(), indexModels)
|
||||
|
Loading…
Reference in New Issue
Block a user