Fix CIF Indexes
All checks were successful
Go Test / test (push) Successful in 31s

This commit is contained in:
Fred Boniface 2024-04-23 16:54:29 +01:00
parent 16bff981cc
commit 652d900618

View File

@ -157,34 +157,34 @@ func CreateTimetableIndexes() error {
coll := MongoClient.Database(DatabaseName).Collection(TimetableCollection) coll := MongoClient.Database(DatabaseName).Collection(TimetableCollection)
indexModels := []mongo.IndexModel{ indexModels := []mongo.IndexModel{
{ {
Keys: bson.M{ Keys: bson.D{
"trainUid": 1, {Key: "trainUid", Value: 1},
"stpIndicator": 1, {Key: "stpIndicator", Value: 1},
"scheduleStartDate": 1, {Key: "scheduleStartDate", Value: 1},
}, },
Options: options.Index().SetName("delete_query"), Options: options.Index().SetName("delete_query"),
}, },
{ {
Keys: bson.M{ Keys: bson.D{
"trainUid": 1, {Key: "trainUid", Value: 1},
"scheduleStartDate": 1, {Key: "scheduleStartDate", Value: 1},
"scheduleEndDate": 1, {Key: "scheduleEndDate", Value: 1},
"daysRun": 1, {Key: "daysRun", Value: 1},
}, },
Options: options.Index().SetName("find_by_uid"), Options: options.Index().SetName("find_by_uid"),
}, },
{ {
Keys: bson.M{ Keys: bson.D{
"headcode": 1, {Key: "headcode", Value: 1},
"scheduleStartDate": 1, {Key: "scheduleStartDate", Value: 1},
"scheduleEndDate": 1, {Key: "scheduleEndDate", Value: 1},
"daysRun": 1, {Key: "daysRun", Value: 1},
}, },
Options: options.Index().SetName("find_by_headcode"), Options: options.Index().SetName("find_by_headcode"),
}, },
{ {
Keys: bson.M{ Keys: bson.D{
"serviceDetail.vstp": 1, {Key: "serviceDetail.vstp", Value: 1},
}, },
Options: options.Index().SetName("vstp"), Options: options.Index().SetName("vstp"),
}, },