• /
  • EnglishEspañolFrançais日本語한국어Português
  • Se connecterDémarrer

Cette traduction automatique est fournie pour votre commodité.

En cas d'incohérence entre la version anglaise et la version traduite, la version anglaise prévaudra. Veuillez visiter cette page pour plus d'informations.

Créer un problème

UserStorageMutation

Enregistrez, supprimez ou mettez à jour un document défini par l'utilisateur dans NerdStorage.

Usage

import { UserStorageMutation } from 'nr1'

Exemples

Rédiger un document

UserStorageMutation.mutate({
actionType: UserStorageMutation.ACTION_TYPE.WRITE_DOCUMENT,
collection: 'myCollection',
documentId: 'myDocumentId',
document: {
name: 'John',
surname: 'Doe',
},
});

Supprimer le document

UserStorageMutation.mutate({
actionType: UserStorageMutation.ACTION_TYPE.DELETE_DOCUMENT,
collection: 'myCollection',
documentId: 'myDocumentId',
});

Supprimer la collection

UserStorageMutation.mutate({
actionType: UserStorageMutation.ACTION_TYPE.DELETE_COLLECTION,
collection: 'myCollection',
});

Accessoires

actionType

OBLIGATOIRE
énumération

Type d'action à réaliser.

<One of

UserStorageMutation.ACTION_TYPE.DELETE_COLLECTION, UserStorageMutation.ACTION_TYPE.DELETE_DOCUMENT, UserStorageMutation.ACTION_TYPE.WRITE_DOCUMENT,

>

children

OBLIGATOIRE
fonction

Rendre la fonction prop comme des enfants.

function (
mutate: function,

Function to trigger a mutation from your UI.

mutationResult: MutationResult

Results of the mutation.

) => React.ReactNode

collection

chaîne

Nom de la collection.

document

objet

Document NerdStorage. Les documents sont limités à une taille de 64 Ko lorsqu'ils sont convertis en chaîne JSON.

documentId

chaîne

Document identifiant pour opérer. En cas d'omission, la collection entière est renvoyée.

Méthodes

UserStorageMutation.mutate

function (
props: Object

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

) => PromiseQueryResult

Définitions de types

PromiseQueryResult

{
error: ApolloClient.ApolloError,

Runtime error with graphQLErrors and networkError properties.

data: Object,

Object containing the result of your query.

fetchMore: function|null,

If not null, fetchMore allows you to load more results for your query. New data is merged with previous data.

refetch: function,

Refetch the query.

}

MutationResult

{
loading: boolean,

Indicates that the request is in flight.

error: ApolloClient.ApolloError,

Runtime error with graphQLErrors and networkError properties.

data: Object,

Object containing the result of your mutation.

}
Droits d'auteur © 2025 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.