> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name:

data.items.truncate(dataCollectionId: string)

# Method Link:

https://dev.wix.com/docs/sdk/data-items-sdk/data/items/truncate.md

# Method Description:

Removes all items from a collection.

The `truncate()` method returns a Promise that resolves after all items
have been removed from the specified collection.

`truncate()` runs when the current user is the site owner, or when the method is called with [elevated permissions](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-elevated-permissions.md).

> **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.

# Method Permissions:

- Write Data Items

# Method Permissions Scopes IDs:

- SCOPE.DC-DATA.WRITE



# Method Code Examples:

## Site owner removes all items from a collection

```javascript
import { items } from "@wix/data";

async function truncateItems() {
  await items.truncate("myCollection")
  console.log("All items removed");
}
```



## default

```javascript
try {
      const result = await items.truncate("collection-0.21236182986643115");
      return result;
} catch (error) {
      console.error(error);
      throw error;
}
```