Skip to main content

DatasetsManager.delete()

Added in: @mastra/core@1.4.0

Deletes a dataset by ID, including all of its items and versions. Experiments that ran against the dataset are kept but detached: their datasetId and datasetVersion are set to null. Database-backed storage adapters also remove the results of those experiments.

Usage example
Direct link to Usage example

import { Mastra } from '@mastra/core'

const mastra = new Mastra({/* storage config */})

await mastra.datasets.delete({ id: 'dataset-id' })

When organizationId or projectId is provided, deletion is scoped to those values. A tenancy mismatch is a silent no-op.

Parameters
Direct link to Parameters

id:

string
ID of the dataset to delete.

organizationId?:

string
Organization ID used to scope the deletion.

projectId?:

string
Project ID used to scope the deletion.

Returns
Direct link to Returns

result:

Promise<void>
Resolves when the dataset is deleted.
On this page