• /
  • Log in
  • Free account

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

import { AccountStorageMutation } from 'nr1'

Examples

Write document

1
AccountStorageMutation.mutate({
2
accountId: 1,
3
actionType: AccountStorageMutation.ACTION_TYPE.WRITE_DOCUMENT,
4
collection: 'mycollection',
5
documentId: 'mydocumentID',
6
document: {
7
name: 'John',
8
surname: 'Doe',
9
},
10
});

Delete document

1
AccountStorageMutation.mutate({
2
accountId: 1,
3
actionType: AccountStorageMutation.ACTION_TYPE.DELETE_DOCUMENT,
4
collection: 'mycollection',
5
documentId: 'mydocumentID',
6
});

Delete collection

1
AccountStorageMutation.mutate({
2
accountId: 1,
3
actionType: AccountStorageMutation.ACTION_TYPE.DELETE_COLLECTION,
4
collection: 'mycollection',
5
});

Props

accountIdnumber

Account ID.

actionTyperequiredenum

Type of action to perform.

<One of
AccountStorageMutation.ACTION_TYPE.DELETE_COLLECTION,
AccountStorageMutation.ACTION_TYPE.DELETE_DOCUMENT,
AccountStorageMutation.ACTION_TYPE.WRITE_DOCUMENT,
>
childrenrequiredfunction

Render prop function as children.

function (
mutate: function, //

Function to trigger a mutation from your UI.

mutationResult: {Object //

Results of the mutation.

) => undefined
collectionstring

Name of the collection to mutate.

documentobject

NerdStorage document.

Documents are restricted to 64KB in size.

documentIdstring

ID of the document to mutate.

Methods

AccountStorageMutation.render

function () => undefined

AccountStorageMutation.mutate

Static method to use AccountStorageMutation as a Promise instead of as a React component.

function (
props: Object //

Object containing the mutation options. Any AccountStorageMutation prop is a valid option except children.

) => {Object}

Type definitions

PromiseQueryResult

{
loading: boolean, //

Indicates that the request is in flight.

data: Object, //

An object containing the result of your query.

}
Create issueEdit page
Copyright © 2021 New Relic Inc.