• /
  • EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

Intro to NerdStorage

To help you build a New Relic application, we provide you with the New Relic One SDK](/docs/new-relic-solutions/build-nr-ui/sdk-component/intro-to-sdk). On this page, you'll learn how to use NerdStorage SDK components.

Use NerdStorage in your apps

You can use NerdStorage to store and retrieve simple sets of data, including users' configuration settings and preferences, like favorites, or any other small data sets. This storage is unique per Nerdpack, and can't be shared with any other Nerdpack.

NerdStorage falls into three categories:

  • User storage: Data that is attached to a particular user. If you're authenticated as the user the data is attached to, you can read it, and write it.
  • Account storage: Data that is attached to a particular account. If you're authenticated and can access the account, you can read and write to account scoped NerdStorage. Visibility of account data is also determined by master or sub-account rules: If a user has access to the master account, then they also have access to data in all subaccounts.
  • Entity storage: Data that is attached to a particular entity. If you can see the corresponding entity, you can read and write data on that entity.

Data model

You can imagine NerdStorage as a nested key-value map. Data is inside documents, which are nested inside collections:

{
"YourNerdpackUuid": {
"collection-1": {
"document-1-of-collection-1": "{\"lastNumber\": 42, \"another\": [1]}",
"document-2-of-collection-1": "\"userToken\""
// ...
},
"another-collection": {
"fruits": "[\"pear\", \"apple\"]"
// ...
}
// ...
}
}

Each NerdStorage level has different properties and purpose:

  • Collections: From a Nerdpack, you can create multiple collections by naming each of them. Inside a collection you can put one or more documents. Think of a collection as key-value storage, where each document is a key-value pair.
  • Documents: A document consists of an identifier (documentId) and a set of data associated with it.
  • Data associated with a document: NerdStorage accepts any sort of data associated to a documentId. Query and mutation components that are provided work by serializing and deserializing JSON.

注意

NerdStorage is not encrypted. Don't store secrets, API keys, personal access tokens, or license keys.

Limits

  • A Nerdpack can hold up to 1,000 collections and 10,000 documents, plus storage type.
  • A collection can hold up to 1,500 documents, plus storage type.
  • Each document can have a maximum length of 1024 KiB when serialized.

Data access

To access NerdStorage, you can run NerdGraph queries, or use the provided storage queries.

Depending on which storage you want to access, you can use a different set of SDK components:

  • User access: UserStorageQuery and UserStorageMutation
  • Account access: AccountStorageQuery and AccountStorageMutation
  • Entity access: EntityStorageQuery and EntityStorageMutation

Each of these components can operate declaratively, for example, as part of your React rendering methods or imperatively. It uses the static methods for query and mutation.

Permissions for working with NerdStorage

In order to persist changes on NerdStorage, such as creating, updating, and deleting account and entity storage, you must have a user role with permission to persist changes.

Copyright © 2024 New Relic株式会社。

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