title: Query DocumentDB based on lambda expression func<TEntity, dynamic>
body: <p>The requirement is to pass any custom expression query to the documentDB and fetch records based on it.</p>
  
  <pre><code>public Task&lt;dynamic&gt; ExecuteQuery(Func&lt;TEntity, dynamic&gt; lambda)
  {
      dynamic result = client.CreateDocumentQuery&lt;dynamic&gt;(documentCollectionUri).Where(lambda); //compile error
      return result;
  }
  </code></pre>
  
  <p>above function can be called like this:  </p>
  
  <pre><code>var res = await _locationDbRepository.ExecuteQuery(x =&gt; x.Name == "raja" &amp;&amp; x.Address == "abc");
  </code></pre>
  
  <p>Clearly, it will give compile time error because <code>Where()</code> is expecting a <code>predicate</code> but, I need to pass a <code>func</code>. I don't want to pass <code>predicate</code> because it always return a boolean but <code>func</code> can return anything.</p>
  
  <ul>
  <li>A SQL query can be passed to documentDB but then I have to convert lambda expression to SQL query using a 3rd party library which I don't want to use.</li>
  </ul>
  
  <p>The above approach to query <code>documentdb</code> is not working so Any other way you can suggest based on lambda expression?</p>