Skip to content

Commit

Permalink
fix: at fetched-at index to country-statistics collection
Browse files Browse the repository at this point in the history
  • Loading branch information
alsami committed Oct 21, 2020
1 parent f182c42 commit d019e60
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,24 @@ protected override async Task ExecuteAsync()
await collection.Indexes.CreateManyAsync(new[]
{
CreateTotalCasesFetchedAtIndexModel(),
CreateTotalCasesFetchedAtCountryIndexModel()
CreateTotalCasesFetchedAtCountryIndexModel(),
CreatFetchedAtIndexModel()
});
}

private static CreateIndexModel<CountryStatistics> CreatFetchedAtIndexModel()
{
var fetchedAt = Builders<CountryStatistics>
.IndexKeys
.Ascending(statistics => statistics.FetchedAt);

var fetchedAtIndexModel = new CreateIndexModel<CountryStatistics>(fetchedAt, new CreateIndexOptions
{
Name = $"{CollectionNames.CountryStatistics}_fetchedAt"
});
return fetchedAtIndexModel;
}

private static CreateIndexModel<CountryStatistics> CreateTotalCasesFetchedAtIndexModel()
{
var totalCasesFetchedAtIndex = Builders<CountryStatistics>
Expand Down

0 comments on commit d019e60

Please sign in to comment.