title: How to effectively do dynamic query using LINQ against a Azure Cosmos Document DB SQL API?
body: <p>I know that Azure Cosmos DB SQL API allows using SQL syntax to query the documents from it and working for me.</p>
  <p>For eg: <code>SELECT * FROM c WHERE c.DynamicContent.MailingAddress.City LIKE '%PORT%'</code> is working well.</p>
  <p>The data I'm trying to save is like this:</p>
  <pre><code>{
    &quot;Id&quot;: 1001,
    &quot;AttentionName&quot;: &quot;Keyword list&quot;,
    &quot;DynamicContent&quot;: {
      &quot;Agency&quot;: 2,
      &quot;EnteredOn&quot;: &quot;2001-03-30T16:20:00+0000&quot;,
      &quot;UpdatedOn&quot;: &quot;2001-03-30T16:20:00+0000&quot;,
      &quot;Name&quot;: &quot;Sample Name&quot;,
      &quot;MailingAddress&quot;: {
        &quot;Address1&quot;: &quot;501 Abbey St&quot;,
        &quot;City&quot;: &quot;Portland&quot;,
        &quot;StateProvince&quot;: &quot;OR&quot;,
        &quot;PostalCode&quot;: &quot;97215&quot;,
        &quot;Country&quot;: &quot;United States&quot;
      }
    }
  }
  </code></pre>
  <p>and as the content inside the DynamicContent is unstructured and dynamic, I'm using the below class to save the data:</p>
  <pre><code>public partial class CosmosDocument
  {
      [JsonProperty(&quot;Id&quot;)]
      public long Id { get; set; }
  
      [JsonProperty(&quot;AttentionName&quot;)]
      public string AttentionName { get; set; }
  
      [JsonProperty(&quot;DynamicContent&quot;)]
      public dynamic DynamicContent { get; set; }
  } 
  </code></pre>
  <p>The problem I'm facing is not able to do something like this:</p>
  <pre><code>query.Where(c =&gt; c.DynamicContent.MailingAddress.City.Contains(&quot;PORT&quot;)).ToList();
  </code></pre>
  <p>because the properties(dynamic and UI controlled) that may come in the filter are inside a dynamic class and are not strongly typed.</p>
  <p><em><strong>Is there a way to do this properly or at least some other workaround to achieve this?
  Please help with your thoughts.</strong></em></p>