Reputation: 377
How can you query RavenDB 4 to find documents which have a list of documents matching items from a input list?
The following used to work in RavenDB 3 but isn't supported in 4:
List<string> categories = new List<string>() { "C#", "java" });
var jobs = _session.Query<Job, Job_Index>.Where(j => j.Categories.Any(c => c.In(categories)));
Upvotes: 1
Views: 137
Reputation: 60011
I believe something like this should work:
using Raven.Client.Documents.Linq; // needed for .ContainsAny extension method
var categories = new List<string>() { "C#", "java" });
var jobs = _session.Query<Job, Job_Index>
.Where(j => j.Categories.ContainsAny(categories));
Upvotes: 2