Skip to main content
Mastra 1.0 is available 🎉 Read announcement

DatasetsManager.get()

Added in: @mastra/core@1.4.0

Retrieves an existing dataset by ID. Throws a MastraError if the dataset does not exist.

Usage example
Direct link to Usage example

import { Mastra } from "@mastra/core";

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

const dataset = await mastra.datasets.get({ id: "dataset-id" });

// Now use the dataset
const details = await dataset.getDetails();
console.log(details.name);

Parameters
Direct link to Parameters

id:

string
Unique identifier of the dataset.

Returns
Direct link to Returns

Throws MastraError if the dataset is not found.

result:

Promise<Dataset>
A Dataset instance.
On this page