This commit is contained in:
		
							parent
							
								
									7bd9187e64
								
							
						
					
					
						commit
						fe059abd6c
					
				| @ -152,7 +152,7 @@ func RemoveOutdatedServices(cutoff time.Time) (count int64, err error) { | |||||||
| 	return // Automatically returns names values | 	return // Automatically returns names values | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Creates indexes on the Timetable collection | // Creates indexes on the Timetable collection... Index suitability needs checking. | ||||||
| func CreateTimetableIndexes() error { | func CreateTimetableIndexes() error { | ||||||
| 	coll := MongoClient.Database(DatabaseName).Collection(TimetableCollection) | 	coll := MongoClient.Database(DatabaseName).Collection(TimetableCollection) | ||||||
| 	indexModels := []mongo.IndexModel{ | 	indexModels := []mongo.IndexModel{ | ||||||
| @ -164,6 +164,24 @@ func CreateTimetableIndexes() error { | |||||||
| 			}, | 			}, | ||||||
| 			Options: options.Index().SetName("delete_query"), | 			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) | 	_, err := coll.Indexes().CreateMany(context.Background(), indexModels) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user