title: Query CosmosDB with CosmosClient and map to object
body: <p>Right now I have the following code to query my CosmosDB:</p>
  <pre><code>var streamIterator = containerLogs.GetItemQueryStreamIterator(&quot;SELECT * FROM mycontainer&quot;);
  
  while (streamIterator.HasMoreResults)
  {
      var results = await streamIterator.ReadNextAsync();
      var stream = results.Content;
      using var reader = new StreamReader(stream);
      string data = await reader.ReadToEndAsync();
  
      // typeof what..?
      //var dbDocuments = JsonConvert.DeserializeObject&lt;???&gt;(data);
  }
  </code></pre>
  <p>The variable <code>data</code> will contain the following JSON:</p>
  <pre><code>{
      &quot;_rid&quot;: &quot;wDhMAJ9xYHE=&quot;,
      &quot;Documents&quot;: [{
          &quot;id&quot;: &quot;c05c4eee-32d4-458a-8ae8-d22dd0f93839&quot;,
          &quot;CustomProperty1&quot;: &quot;Value 1&quot;,
          &quot;CustomProperty2&quot;: &quot;Value 2&quot;,
          &quot;_rid&quot;: &quot;wDhMAJ9xYHECAAAAAAAAAA==&quot;,
          &quot;_self&quot;: &quot;dbs\/wDhMAA==\/colls\/wDhMAJ9xYHE=\/docs\/wDhMAJ9xYHECAAAAAAAAAA==\/&quot;,
          &quot;_etag&quot;: &quot;\&quot;00000000-0000-0000-7167-28c107aa01d6\&quot;&quot;,
          &quot;_attachments&quot;: &quot;attachments\/&quot;,
          &quot;_ts&quot;: 1597319093
      }],
      &quot;_count&quot;: 1
  }
  </code></pre>
  <p>The <code>Documents</code> part is my actual &quot;domain&quot; model. How can I easily map this back to a list of my domain model class? I used the same class to write to CosmosDB.</p>
  <p>The model looks like this</p>
  <pre><code>public class MyModel
  {
      [JsonProperty(PropertyName = &quot;id&quot;)]
      public Guid Id {get;set;}
      public string CustomProperty1 {get;set;}
      public string CustomProperty1 {get;set;}
  }
  </code></pre>
  <p>So how can I query my CosmosDB so that it returns a list of this class?</p>