> ## Documentation Index
> Fetch the complete documentation index at: https://docs.razebot.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Stored data

> Read and write per-server key-value records inline from a response script.

# Stored data

> Read and write per-server key-value records inline from a response script.

Database tags run **inline**: they execute where they sit in the script and render their result in place. Reads print the value; writes print nothing.

* **Separator:** colons, not `&&` — `{db.get:(namespace):(key)}`.
* **Prefixes:** `db.` and `customdb.` are interchangeable.
* **Scope:** every record is keyed by server, so one guild can never read another's data.
* **Namespaces:** a free-form label you choose (`notes`, `points`, `config`) that groups related keys.

<Note>
  Namespaces and keys cannot contain a colon. Values can contain anything, including further text.
</Note>

***

## Tag reference

<Tabs>
  <Tab title="Read">
    ```text theme={null} theme={null}
    {db.get:(namespace):(key)}
    ```

    Prints the stored value, or nothing at all if the key doesn't exist.

    ```bash theme={null} theme={null}
    ;cc set mynote -- Your note: {db.get:notes:{user.id}}
    ```
  </Tab>

  <Tab title="Check">
    ```text theme={null} theme={null}
    {db.exists:(namespace):(key)}
    ```

    Prints `true` or `false`.

    ```bash theme={null} theme={null}
    ;cc set hasnote -- Note saved: {db.exists:notes:{user.id}}
    ```

    <Warning>
      This cannot be used **inside** a condition. Conditionals are evaluated before database tags resolve, so `{if:{db.exists:...}==true}` does not work. Compare a stored value against a fallback instead:

      ```bash theme={null} theme={null}
      ;cc set mynote -- Your note: {db.get:notes:{user.id}}
      ```
    </Warning>
  </Tab>

  <Tab title="Write">
    ```text theme={null} theme={null}
    {db.set:(namespace):(key):(value)}
    ```

    Inserts or overwrites. Renders nothing.

    ```bash theme={null} theme={null}
    ;cc set note (text...) -- {db.set:notes:{user.id}:{text}}Saved.
    ```
  </Tab>

  <Tab title="Count up / down">
    ```text theme={null} theme={null}
    {db.inc:(namespace):(key):[amount]}
    {db.dec:(namespace):(key):[amount]}
    ```

    *Aliases: `{db.increment:...}`, `{db.decrement:...}`*

    Amount defaults to `1`. A missing key starts from `0`. Both print the **new** value.

    ```bash theme={null} theme={null}
    ;cc set count -- That's strike {db.inc:strikes:{user.id}} for you.
    ```
  </Tab>

  <Tab title="Delete">
    ```text theme={null} theme={null}
    {db.delete:(namespace):(key)}
    ```

    *Alias: `{db.del:...}`*

    Removes the record. Renders nothing.

    ```bash theme={null} theme={null}
    ;cc set clearnote -- {db.delete:notes:{user.id}}Note cleared.
    ```
  </Tab>
</Tabs>

***

## Read-after-write in one command

Inline tags execute left to right, so a `{db.set}` earlier in the script is visible to a `{db.get}` later in the same script:

```bash theme={null} theme={null}
;cc set note (text...) -- {db.set:notes:{user.id}:{text}}Saved. Your note is now: {db.get:notes:{user.id}}
```

<Warning>
  This only holds for inline `db.*` tags. The `{customdb:set ...}` [action](/server-config/custom-commands/actions#custom-database-actions) runs **after** all inline tags, so a `{db.get}` in the same script would still show the old value.
</Warning>

***

## Inline tags versus actions

|                       | Inline `{db.set:...}` | Action `{customdb:set ...}` |
| :-------------------- | :-------------------- | :-------------------------- |
| Separator             | `:`                   | `&&`                        |
| Renders output        | Yes, for reads        | No                          |
| Requires a permission | **No**                | `manage_guild`              |
| Runs at               | Before actions        | After inline tags           |

<Note>
  Inline tags are not permission-gated, but they cannot be injected either — braces in anything a member types are neutralised before the script is parsed. See [User input is inert](/server-config/custom-commands/testing-debugging#user-input-is-inert).
</Note>
