# dataset.updateItem()

**Added in:** `@mastra/core@1.4.0`

Updates an existing item in the dataset. Only the provided fields are updated. Updating an item creates a new version.

## Usage example

```typescript
import { Mastra } from '@mastra/core'

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

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

const updated = await dataset.updateItem({
  itemId: 'item-id',
  input: { question: 'What is TypeScript?' },
  groundTruth: { answer: 'A typed superset of JavaScript' },
  metadata: { reviewed: true },
})
```

## Parameters

**itemId** (`string`): ID of the item to update.

**input** (`unknown`): Updated input data.

**groundTruth** (`unknown`): Updated ground truth.

**metadata** (`Record<string, unknown>`): Updated metadata.

## Returns

**result** (`Promise<DatasetItem>`): The updated dataset item. See dataset.addItem() for the item shape.