A deleteData function is created in the Backend Code, which uses a wixData library function called truncate with a supressAuth parameter set to true - allowing anyone to delete data from the collection. Then the deleteData function can be imported to any Page Code and passed the collection/dataset name to delete i.e. truncate. Truncation deletes all the data in a dataset, but not the dataset itself.
Note that the truncate function also clears multiple-item reference fields in collections referenced by the specified collection. For example, suppose you have a Movies collection with an Actors field that contains multiple references to items in a People collection. Truncating the Movies collection also clears the data in the corresponding multiple-item reference field in the People collection.