public async Task <List <CarModel> > GetCarsByModel(string model) { var cars = new List <CarModel>(); var carsByModel = CarCollection.Find(car => car.Model == model); await carsByModel.ForEachAsync(doc => cars.Add(doc)); return(cars); }
public async Task <List <CarModel> > GetCars() { var cars = new List <CarModel>(); var allDocuments = CarCollection.Find(new BsonDocument()); await allDocuments.ForEachAsync(doc => cars.Add(doc)); return(cars); }