mongodb/mongo-csharp-driver — pull request #95 by dariusriggins (2012-04-16 17:54:10+00:00)
Title: Add ability to do Any predicates within a where clause

I'm writing a limited security framework, where I do some authorization then filter down an IQueryable to ensure people don't get back stuff they shouldn't be allowed to see. Common stuff. Problem I have is they can belong to multiple groups, and I want the where to focus that, here's the code I'm using now.

var restriction1 = restriction;
source = source.Where(i => i.DivisionIds.Any(y => y == restriction1.AppliedTo.Qualifier.Id));

So this is to allow this incredibly contrived example, I don't think my implementation is good in any way, but it works and might give you some direction in a way you might like to implement it. Added a test that should be 3.5 compatible as well. Broke 1 test that was expecting a NotSupportedException.