Enregistrez, supprimez ou mettez à jour un document de portée de compte dans NerdStorage. Afin de réaliser cette opération avec succès, l'utilisateur doit disposer des autorisations appropriées.
Usage
import { AccountStorageMutation } from 'nr1'Exemples
Rédiger un document
AccountStorageMutation.mutate({ accountId: 1, actionType: AccountStorageMutation.ACTION_TYPE.WRITE_DOCUMENT, collection: 'myCollection', documentId: 'myDocumentId', document: { name: 'John', surname: 'Doe', },});Supprimer le document
AccountStorageMutation.mutate({ accountId: 1, actionType: AccountStorageMutation.ACTION_TYPE.DELETE_DOCUMENT, collection: 'myCollection', documentId: 'myDocumentId',});Supprimer la collection
AccountStorageMutation.mutate({ accountId: 1, actionType: AccountStorageMutation.ACTION_TYPE.DELETE_COLLECTION, collection: 'myCollection',});Accessoires
OBLIGATOIREnombre | Identifiant du compte. |
OBLIGATOIREénumération | Type d'action à réaliser. <One of |
OBLIGATOIREfonction | Rendre la fonction prop comme des enfants. function ( |
OBLIGATOIREchaîne | Nom de la collection. |
objet | Document NerdStorage. Les documents sont limités à une taille de 64 Ko lorsqu'ils sont convertis en chaîne JSON. |
chaîne | Document identifiant pour opérer. En cas d'omission, la collection entière est renvoyée. |
Méthodes
AccountStorageMutation.mutate
function (props: Object Object containing the mutation options. Any AccountStorageMutation prop is a valid option except children.
) => PromiseQueryResultDé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.
}