title: How to query against Dictionary contents in Azure CosmosDB/DocumentDB?
body: <p>I am storing objects in Azure CosmosDB from C# code. The properties of these objects are not fully defined when the application starts, so some may be added or removed at runtime. That is why I have a property "Attributes" of type Dictionary in the model class:</p>
  
  <pre><code>public Dictionary&lt;string, string&gt; Attributes { get; }
  </code></pre>
  
  <p>But how do I write queries against the contents of this property? For example, I would like to write a query like:</p>
  
  <pre><code>documentQueryable
    .Where(doc =&gt; doc.Attributes.ContainsKey("City") &amp;&amp; doc.Attributes["City"] == "NY");
  </code></pre>
  
  <p>However, this is not supported:</p>
  
  <pre><code>Microsoft.Azure.Documents.Linq.DocumentQueryException: Method 'ContainsKey' is not supported., documentdb-dotnet-sdk/1.22.0 Host/32-bit MicrosoftWindowsNT/10.0.14393.0
  </code></pre>