Reputation: 6296
Raven DB gave me this message
Method not supported: Contains
for this code :
using (var d = DataLayer.RavenDB.d.OpenSession())
{
foos = d.Query<Foo>().Where(foo => ids.Contains(foo.Id)).Skip(i * 10).Take(10).ToList();
}
how can I retrieve my list foos
?
Upvotes: 0
Views: 59
Reputation: 5874
if you want to load the documents based on the list of ids, go the solution suggested by Matt, performance wise Load() is the best approach.
but if you still wants to get it using Query (using some where contiions) change the code like this
using (var d = DataLayer.RavenDB.d.OpenSession())
{
foos = d.Query<Foo>()
.Where(foo => foo.Id.In<string>(ids))
.Skip(i * 10)
.Take(10).ToList();
}
Upvotes: 1
Reputation: 241535
It looks like you are trying to query multiple documents by id. Querying by Id is not recommended in Raven. Load them instead. There is an overload that takes multiple Ids.
foos = session.Load<Foo>(ids);
If this was some other property rather than Id, you would use item.In(list)
rather than list.Contains(item)
.
Upvotes: 2