# db

### Utilizing database

`db.key_name:` <mark style="color:purple;">`any`</mark>

`db.key_name = value`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>key_name</strong></td><td><strong><code>any</code></strong></td><td>Name of the key</td></tr><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>Value the key should be set to. This can be anything that can be sanitized (no functions, userdata)</td></tr></tbody></table>

{% hint style="warning" %}
Indexing database keys is a heavy process. Do not do it inside callbacks that are called a lot of times per second.
{% endhint %}

```lua
-- look up for database key named "test"
-- returns the new table if database returned nil
local data = db.test or { }

data.name = 'Salvatore'
data.project = 'Spirthack Innovations LLC'

events.shutdown:set(function()
    -- replace "test" key with the new value
    db.test = data
end)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-csgo.neverlose.cc/documentation/variables/db.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
