Intro to NerdStorage on New Relic One

To help you build a New Relic One application, we provide you with the New Relic One SDK. On this page, you’ll learn how to use NerdStorage SDK components.

NerdStorage is used 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.

This type of storage can be broken down into three conceptual categories:

  • User storage: Data is attached to a particular user. If you’re authenticated as the user the data is attached to, you’ll be able to read and write.

  • Account storage: Data is attached to a particular account, meaning that all sub-accounts and users in those accounts can read and write the data. If you’re authenticated and can access the account, you’ll be able to read and write.

  • Entity storage: Data is attached to a particular entity. If you’re able to see the corresponding entity (meaning that they belong to an account containing the entity), you’ll be able to read and write.

Data model

NerdStorage is divided into different levels:

  • Collections: From a Nerdpack, you can create multiple collections by giving each of them a name. Inside a collection you’ll be able to put one or more documents. You can think of a collection as a key-value storage, where each document is one of these key-value pairs. There is a limit of 10,000 collections per Nerdpack.

  • Documents: A document is formed by an identifier (called documentId) and a set of data associated with it. There’s a limit of 5,000 documents per collection.

  • Data associated with a document: NerdStorage accepts any sort of data associated to a documentId, but the query and mutation components that are provided work by serializing and de-serializing JSON. Each document can have a maximum length of 64 KiB when serialized.

Conceptually, you can imagine NerdStorage as a nested key-value map:

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

To access NerdStorage, you can use either raw NerdGraph queries or (more easily) the provided storage queries.

Data access