Clear Collection Data at once

You can pretty much use that code anywhere. Depending on your use case and the sensitivity of the data, you might want to put this code in a backend file, and invoke it from a password protected page.