title: Read the number of records from a collection using cosmos client to a console app
body: <p>I am using cosmos client and C# to delete items from a collection. In the process I would like to check the number of records that are in the collection, I have the data part of it and the query but I am stuck at what to use since I will be only be receiving an int not a stream of data.</p>
  
  <p>For deleting data I am using FeedIterator since we get a stream of data.
  FeedIterator queryResultSetIterator = this.container.GetItemQueryIterator(queryDefinition);</p>
  
  <p>List orders = new List();</p>
  
  <p>I delete the records by looping through the list</p>
  
  <p>What should I be using in place of FeedIterator since the output is going to be the number of records in the collection?</p>
  
  <pre><code>var sqlQueryText1 = "SELECT value count(1) from c where c.tenantId = 
  '5d484526d76e9653e6226aa2'";
  QueryDefinition queryDefinition1 = new QueryDefinition(sqlQueryText1);
  </code></pre>
  
  <p>This is the article I used to help with the console app:
  <a href="https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-get-started" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-get-started</a></p>