> For the complete documentation index, see [llms.txt](https://docs.scratch-for-discord.com/use/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scratch-for-discord.com/use/toolbox/functions/database.md).

# Database

Databases are used to keep your values after your bot has been rebooted.

unlike [Variables](/use/toolbox/functions/variables.md), databases will keep it.

## JSON

use this for "start" if you don´t understand any other, the most easiest database

### Creating a new database

<figure><img src="/files/MlpqpkdWXQa7vt0OVrlF" alt=""><figcaption><p>Use this block to create a new database file</p></figcaption></figure>

### Informations

<figure><img src="/files/26uzYkK9vVKyxvZxm7Iy" alt=""><figcaption></figcaption></figure>

Output will be "world" because you previously set it in the database

### Management

<figure><img src="/files/T5CyfLuGa0XhSNC5Hail" alt=""><figcaption><p>Example of managing a database, first check if the value either exists or is in NUMBERS, if not define it to 0</p></figcaption></figure>

### How to store money for different users?

<figure><img src="/files/QVgwzAl2AX6cQu36FuaV" alt=""><figcaption><p>Example of giving message user point for every message</p></figcaption></figure>

## MongoDB

Works the same as JSON database, just you must create an account at <https://www.mongodb.com/>

1. Create an account
2. Create a new cluster "shared"
3. That is free up to 500 MB of data
4. click on connect
5. connect your application
6. copy the text

   <figure><img src="/files/D34SS9de3sApij91hCZv" alt=""><figcaption></figcaption></figure>
7. change your username and password
8. go to security / network access and add IP 0.0.0.0/0
9. add your link to the connect to mongoDB block

   <figure><img src="/files/yxGLRSLxPPanO437wJH2" alt=""><figcaption></figcaption></figure>
10. Install the plugin by running `npm i git+`[`https://github.com/ahqsoftwares/quickmongo.git`](https://github.com/ahqsoftwares/quickmongo.git) in the shell, and you are done!

## SQLite

Basic Database that is used the most and everywhere.

works the same as JSON or MongoDB

## Replit

Database made specially for Replit.com

It has less functions, but it exists.

you can only get, set and delete, so I have no idea why to use this one...


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.scratch-for-discord.com/use/toolbox/functions/database.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
