deleteDataCollection( )


Deletes a data collection.

Note: Once a collection is deleted, it can't be restored.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Data Collections
Learn more about app permissions.
Method Declaration
Copy
function deleteDataCollection(dataCollectionId: string): Promise<void>;
Method Parameters
dataCollectionIdstringRequired

ID of the collection to delete.

JavaScript
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 */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?