title: Is there any c# code for deleting cosmos DB documents
body: <p>I am working on an .net api development in which one task is deletes some documents based on the condition .The documents is resided in Cosmos DB.</p>
  
  <p>I have tried via stored procedures but  didnt get proper SP which deleted record.I have tried fetching the documents using select query with where condition and by loop through it fetched and passed document ID and I've tried to delete 
  <code>using DeleteDocumentAsync</code></p>
  
  <pre><code>//---Deleting Document based on documentId from corresponding DbName,CollectionName-----------//
  
   private async Task DeleteSecurityDocument(string databaseName, string collectionName, string documentName)
          {
  
                  string endPoint = ConfigurationManager.AppSettings["DocDbEndPoint"];
                  string masterKey = ConfigurationManager.AppSettings["DocDbmasterKey"];
  
                  var client = new DocumentClient(new Uri(endPoint), masterKey);
  
                  await client.DeleteDocumentAsync(UriFactory.CreateDocumentUri(databaseName, collectionName, documentName));    
  
          }
  </code></pre>