'Container delete items async for large quantities of id

I'm fairly new to cosmos db, and I have a function that deletes the entries of a record. Currently I'm using this method "container.DeleteItemsAsync". It is working, but the problem is, whenever I try to delete thousands of ids, I received a time out. Is there a method that supports batch deletion?



Solution 1:[1]

Have you enabled Bulk mode and try deleting the documents? It should work the same way for Create

 _client = new CosmosClient(connectionString, new CosmosClientOptions() { AllowBulkExecution = true });

// Delete item with 'id':
var partitionKey = new PartitionKey(id);
tasks.Add(_devicesContainer.DeleteItemStreamAsync(id, partitionKey));

// Wait processing to finish
await Task.WhenAll(tasks);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sajeetharan