title: Complex query filtering of object arrays in MongoDb (C# Driver)
body: <p>Let's say I have this document.</p>
  <pre><code>&quot;Id&quot; : &quot;lot1&quot;,
  &quot;Fruits&quot; : [
         [{ &quot;Id&quot;: &quot;fruit1&quot;, &quot;Name&quot;: &quot;apple&quot;}, { &quot;Id&quot;: &quot;fruit2&quot;, &quot;Name&quot;: &quot;carrot&quot;}]
         [{ &quot;Id&quot;: &quot;fruit3&quot;, &quot;Name&quot;: &quot;banana&quot;}]
       ]
  </code></pre>
  <p><strong>Q:</strong> How can I query the Fruits array by a list of fruits names ?</p>
  <p>I have tried like this:</p>
  <pre><code>var fruitNames = new List&lt;string&gt;(){ &quot;apple&quot;, &quot;banana&quot; };
  var builder = Builders&lt;Lot&gt;.Filter;
  var filter = builder.AnyIn(l =&gt; l.Fruits.Select(f =&gt; f.Name), fruitNames); //TAKE 1
  var filter = builder.Where(l =&gt; l.Fruits.Select(f =&gt; f.Name).Any(f =&gt; fruitNames.Contains(f)));//TAKE 2
  var filter = builder.AnyIn(&quot;Fruits.Name&quot;, fruitNames );//TAKE 3
  var results = mongoContext.Lots.Find(filter).ToList();
  </code></pre>
  <p>I have tried this in 3 different ways with no success.</p>