Home > Back-end >  Is there a way to purge all documents from an CosmosDB Container using the Azure Portal?
Is there a way to purge all documents from an CosmosDB Container using the Azure Portal?

Time:12-20

I'm developing an app that uses a CosmosDB container. Every so often, I want to purge one of the testing containers. Using the Azure Portal, I drop the container and create a new one with the same name and attributes.

Simple enough, but this feels unnecessary. Every so often I'll type something wrong. Is there a way to delete all documents in a container, without the need to recreate it, via the web Portal? It feels as if this might exist in a menu somewhere and I'm just unable to find it.

CodePudding user response:

You can se the time to live of the container to something like 1 second Link. It will take some time depending on the number of documents and the throughput of your Cosmos DB.

Deletion by TTL will only use left over RU/s so it will not affect your application if your application is live.

  • Related