Deletes a data collection.
Note: Once a collection is deleted, it can't be restored.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function deleteDataCollection(dataCollectionId: string): Promise<void>;
ID of the collection to delete.
import { collections } from "wix-data.v2";
// Deleting the collection whose _id is "myMusicCollection":
// const dataCollectionId = "myMusicCollection"
export async function myDeleteDataCollectionFunction(dataCollectionId) {
try {
await collections.deleteDataCollection(dataCollectionId);
return;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to void */
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.