Refactor- name of the product going to be unique, why have to declare ToList ?
Jeevananthan-23 opened this issue · 0 comments
Jeevananthan-23 commented
public async Task<IEnumerable<Product>> GetProductByName(string name)
{
FilterDefinition<Product> filter = Builders<Product>.Filter.ElemMatch(p => p.Name, name);
return await _context
.Products
.Find(filter)
.ToListAsync();
}