• /
  • Log in
  • Free account

EntityStorageMutation

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

Usage

import { EntityStorageMutation } from 'nr1'

Examples

Write document

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

Delete document

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

Delete collection

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

Props

actionTyperequiredenum

Type of action to perform.

<One of
EntityStorageMutation.ACTION_TYPE.DELETE_COLLECTION,
EntityStorageMutation.ACTION_TYPE.DELETE_DOCUMENT,
EntityStorageMutation.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.

entityGuidstring

GUID of the entity in which the collection is stored.

Methods

EntityStorageMutation.render

function () => undefined

EntityStorageMutation.mutate

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

function (
props: Object //

Object containing the mutation options. Any EntityStorageMutation 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.