I am able to query all the items of a collection using 2 approaches
a)
var findAll = await Context.ItemsCollection.FindAsync(_ => true);
var res = await findAll.ToListAsync();
b)
var res = await.Context.ItemsCollection.Find(_ => true).ToListAsync();
Is there a real difference between them?Which one should I prefer ?
There's no real difference. It will eventually behave the same.
Find
doesn't execute the query, while FindAsync
does, but using ToListAsync
makes that difference irrelevant.