[Cosmosdb]-[nice to have] truncate functionality on collection
Currently there is no truncate functionality available on a collection. The current option is to delete the collection and recreate it from scratch in order to wipe all data.This affects the DDL(schema) and manual is error prone. It would be nice if collection supports truncate operation.
Hello and thank you for your suggestion.
Horizontally partitioned databases do not work like a relational database. There is no schema so there is nothing that could be error prone to deleting the container. In addition, deleting and recreating the container frees up physical partitions that may have been created to support the storage of the previous container.
Additionally, doing a truncate or delete on every item in a container would incur RU charges, whereas just deleting and recreating the container would not.
For these reasons we recommend customers use this method.
Thanks again for your suggestion.