---
title: AccountStorageMutation
source: https://docs.newrelic.com/docs/new-relic-solutions/build-nr-ui/sdk-component/query-and-storage/AccountStorageMutation
---

Save, delete, or update an account scoped document in NerdStorage. In order to successfully perform this operation, the user must have the right permissions.

### Usage

```js
import { AccountStorageMutation } from 'nr1'
```

### Examples

#### Write document

```js
AccountStorageMutation.mutate({
  accountId: 1,
  actionType: AccountStorageMutation.ACTION_TYPE.WRITE_DOCUMENT,
  collection: 'myCollection',
  documentId: 'myDocumentId',
  document: {
    name: 'John',
    surname: 'Doe',
  },
});
```

#### Delete document

```js
AccountStorageMutation.mutate({
  accountId: 1,
  actionType: AccountStorageMutation.ACTION_TYPE.DELETE_DOCUMENT,
  collection: 'myCollection',
  documentId: 'myDocumentId',
});
```

#### Delete collection

```js
AccountStorageMutation.mutate({
  accountId: 1,
  actionType: AccountStorageMutation.ACTION_TYPE.DELETE_COLLECTION,
  collection: 'myCollection',
});
```

### Props

| `accountId` REQUIRED number | Account identifier.                                                                                                                                                                     |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `actionType` REQUIREDenum   | Type of action to perform. AccountStorageMutation.ACTION_TYPE.DELETE_COLLECTION, AccountStorageMutation.ACTION_TYPE.DELETE_DOCUMENT, AccountStorageMutation.ACTION_TYPE.WRITE_DOCUMENT, |
| `children` REQUIREDfunction | Render prop function as children.                                                                                                                                                       |
| `collection` REQUIREDstring | Collection name.                                                                                                                                                                        |
| `document` object           | NerdStorage document. Documents are restricted to 64 kB in size when JSON-stringified.                                                                                                  |
| `documentId` string         | Document identifier to operate in. When omitted the whole collection is returned.                                                                                                       |

### Methods

### `AccountStorageMutation.mutate`

### Type definitions
