private async Task <Dictionary <Guid, string> > GetIdNflMapAsync(MongoDbContext mongoDbContext) { var playerFindOptions = new FindOptions <PlayerDocument> { Projection = Builders <PlayerDocument> .Projection .Include(p => p.Id) .Include(p => p.NflId) }; List <PlayerDocument> playerDocuments = await mongoDbContext.FindAsync(findOptions : playerFindOptions); return(playerDocuments.ToDictionary(p => p.Id, p => p.NflId)); }
private async Task <Dictionary <string, Guid> > GetNflIdMapAsync(MongoDbContext mongoDbContext) { var findOptions = new FindOptions <PlayerDocument> { Projection = Builders <PlayerDocument> .Projection .Include(p => p.Id) .Include(p => p.NflId) }; List <PlayerDocument> players = await mongoDbContext.FindAsync(findOptions : findOptions); return(players.ToDictionary(p => p.NflId, p => p.Id, StringComparer.OrdinalIgnoreCase)); }
private Task <List <Guid> > GetPlayerIdsAsync(WeekInfo week, MongoDbContext mongoDbContext) { var builder = Builders <WeekStatsPlayerDocument> .Filter; var filter = builder.Eq(s => s.Season, week.Season) & builder.Eq(s => s.Week, week.Week); var findOptions = new FindOptions <WeekStatsPlayerDocument, Guid> { Projection = Builders <WeekStatsPlayerDocument> .Projection .Expression(p => p.PlayerId) }; return(mongoDbContext.FindAsync(filter, findOptions)); }