bulkRemove( )


Removes a number of items from a collection.

The bulkRemove() function returns a Promise that resolves after the items have been removed from the specified collection. The Promise is rejected if the current user does not have "delete" permissions for the collection. If the delete permissions for the collection are set to Site member author, the only items that will be deleted are those for which the current user is the owner. All other items will be skipped.

Calling the bulkRemove() function triggers the beforeRemove() and afterRemove() hooks for each item that is deleted if the hooks have been defined.

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

Notes:

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

  • Bulk operations are limited to 1000 items per function call.

Method Declaration
Copy
Method Parameters
collectionIdstringRequired

The ID of the collection to remove the items 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.


itemIdsArray<string>Required

IDs of the items to remove.

The array must contain at least one item. Passing an empty array returns an error.


optionsWixDataOptions

An object containing options to use when processing this operation.

Returns
Return Type:Promise<WixDataBulkRemoveResult>
Was this helpful?
Yes
No