title: Azure CosmosDB: stored procedure delete documents based on query
body: <p>The goal is to input a simple string query like</p>
  
  <pre><code>SELECT * 
  FROM c 
  WHERE c.deviceId = "device1"
  </code></pre>
  
  <p>and all resulting fetched documents need to be deleted.</p>
  
  <p>I have found very old posts about doing this with a stored procedure, but I can't get it to work properly with the "new" UI.  </p>
  
  <p>Thanks a lot in advance.</p>
  
  <p><strong>EDIT</strong>: I feel like @jay-gong pointed to the correct direction but I encountered a problem with his solution:</p>
  
  <p>I can correctly create the stored procedure but when I try to execute it it asks for the partition key, which I give but after executing, it doesn't delete any document.  </p>
  
  <p>The collection just has a few documents and its partition key is <code>/message/id</code> which is what I wrote in the partition key field.</p>