title: MongoDB C# Query Array of Objects that contain a property value
body: <p>My documents have an array property in them.  Lets call it arrayProperty something like this:</p>
  
  <pre><code> {
    _id: mongoObjectIdThingy,
    arrayProperty: [
      {string1: "aString",otherProperty:"somethingelse"},
      {string1: "aString2",otherProperty:"somethingelse"}
    ]
  }
  </code></pre>
  
  <p>I'm using the mongodb c# driver.   I want to find all documents that contain any of a list of string1 values.  For example say I have a list of strings:</p>
  
  <pre><code>["a","b","aString"]
  </code></pre>
  
  <p>I want the query to return the above document.  I've tried this:</p>
  
  <pre><code>    var builder = Builders&lt;MyObject&gt;.Filter;
  
      var listToFind = new List&lt;string&gt;{"a","b","aString"};
  
  
      return builder.ElemMatch(o =&gt; o.arrayProperty,
          d =&gt; listToFind.Contains(d.string1));
  </code></pre>
  
  <p>But got this exception:</p>
  
  <blockquote>
    <p>Unsupported filter:
    Contains(value(System.Collections.Generic.List`1[System.String]))</p>
  </blockquote>
  
  <p>It seems like I can't do a contains linq expression in the driver's filter expression. How does one write this type of query in mongoDB with C#?</p>