public async Task <IList <TileDbEntity> > GetAllTilesWithLimitedRecentData(int amountOfRecentData, CancellationToken cancellationToken) { var projection = Builders <TileDbEntity> .Projection.FetchRecentData(amountOfRecentData).FetchGroup().FetchConfiguration(); return(await _context.GetTiles().Find(_ => true) .Project <TileDbEntity>(projection) .ToListAsync(cancellationToken)); }
public async Task <bool> AddDataAsync(string tileName, WeatherData weatherData, CancellationToken cancellationToken) { var result = await _context.GetTiles().UpdateOneAsync( TileDbEntityExtensions.TileDbFilter(tileName, TileType.Weather), Builders <TileDbEntity> .Update.Push(x => x.Data, weatherData.ToBsonDocument()), null, cancellationToken); return(result.ModifiedCount > 0); }