Removes all items from a collection.
The truncate()
function returns a Promise that resolves
after all items have been removed from the specified collection.
truncate()
runs when at least one of the following is true:
suppressAuth
options value of true
.Calling the truncate()
function does not trigger any hooks.
Note: truncate()
also clears multiple-item reference fields in collections referenced by the specified collection.
For example, suppose you have a Movies collection with an Actors field that contains multiple references
to items in a People collection. Truncating the Movies collection also clears the data in the corresponding
multiple-item reference field in the People collection.
The ID of the collection to remove 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.
An object containing options you can use when calling this function.