title: Delete multiple entities at once using Azure Table Storage Node.js interface
body: <p>The only delete operation I get deletes one at a time: <a href="https://www.windowsazure.com/en-us/develop/nodejs/how-to-guides/table-services/#delete-entity" rel="nofollow">https://www.windowsazure.com/en-us/develop/nodejs/how-to-guides/table-services/#delete-entity</a></p>
  
  <p>What I want is equivalent to the SQL statement</p>
  
  <pre><code>DELETE FROM MyTable WHERE PartitionKey = 'something'
  </code></pre>
  
  <p>Also on that page is a way to send a batch (although I could not get this to work with delete, anyone know why?). However, I'd first have to do a select to get the list of entities I want to delete in order to get their RowKeys. I was wondering whether it's possible to do it in only one request to Azure.</p>
  
  <p>Thanks in advance.</p>
  
  <p>UPDATE: Here's the code I tried and it doesn't work. I have confirmed that all arguments are correct when the function is called.</p>
  
  <pre><code>// subAccts all have PartitionKey = pKey
  function deleteAccount(pKey, rKey, subAccts, callback) {
    var tasks = subAccts; // rename for readability
    tasks.push({ PartitionKey: pKey, RowKey: rKey });
    tableService.beginBatch();
    async.forEach(tasks, function(task, callback) {
      tableService.deleteEntity(myTable, task, function(error) {
        if (!error) {
          callback(null);
        }
        else {
          console.log(error);
          callback(error);
        }
      });
    }, function(error) {
      if (error) {
        console.log(error);
        callback(error);
        return;
      }
      tableService.commitBatch(callback);
    });
  }
  </code></pre>