remove( )


Removes an item from a collection.

The remove() function returns a Promise that resolves to the removed item after it has been removed from the specified collection. The Promise is rejected if the current user does not have "delete" permissions for the collection.

Calling the remove() function triggers the beforeRemove() and afterRemove() hooks if they have been defined.

Use the options parameter to run remove() from backend code without checking for permissions or without its registered hooks.

Notes:

  • The remove() function also clears multiple-item reference fields for items in collections referenced by the specified item. For example, suppose you have a Movies collection with an Actors field that contains multiple references to items in a People collection. Removing an item in the Movies collection also clears the data in the corresponding multiple-item reference fields in the People collection.
Method Declaration
Copy
Method Parameters
collectionIdstringRequired

The ID of the collection to remove the item from.

To find your collectionId, select the Databases tab in the Velo Sidebar. Hover over your collection, click the three dots, and select Edit Settings.


itemIdstringRequired

The ID of the item to remove.


optionsWixDataOptions

An object containing options to use when processing this operation.

Returns
Return Type:Promise<object>
Did this help?