> For the complete documentation index, see [llms.txt](https://docs.lidistat67.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lidistat67.eu/setting-up-mongodb.md).

# Setting Up MongoDB

To be able to store data such as logs, you will need to use your own database. A database is required, as the database also stores configuration data for your bot.

Upon creating an account, you will be greeted with this page. Make sure you select Starter Cluster. <br>

<figure><img src="https://2270761089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft65ljAxhdyeMKMFD4OR5%2Fuploads%2F4crf1SLy1R81CmZCjE1S%2FEIGHT.png?alt=media&amp;token=bf6f5524-63ea-4312-acca-348c22f53385" alt=""><figcaption></figcaption></figure>

After this, you will be taken to the below screen: <br>

<figure><img src="https://2270761089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft65ljAxhdyeMKMFD4OR5%2Fuploads%2FvfOCbcyNX7gW63E9ONSF%2FNINE.png?alt=media&amp;token=951a7e39-f304-47bc-9ae0-647257428e48" alt=""><figcaption></figcaption></figure>

Select one of the servers marked with `FREE TIER AVAILABLE` and click on `Create Cluster`. It will only take a couple of minutes to configure everything for you.

Follow the "Getting Started" tutorial on the bottom left.<br>

Go to the `Database Access` section in the `security` tab. Click on `+ Add New User` to create a new user, whereupon a new screen will pop up. `Select Read and write to any database`, so the bot can properly store the data. Choose a username and password, but make sure they both **don't contain any special character like** `!`, `-`, `?`. Copy the password into your notepad.

Finally, click `Add User` to finish the creation.<br>

<figure><img src="https://2270761089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft65ljAxhdyeMKMFD4OR5%2Fuploads%2F6F5cgWcfPLGzx2z6tNTh%2FTEN.png?alt=media&amp;token=758d1c9a-0cee-4648-b84d-ed25f0512bd1" alt=""><figcaption></figcaption></figure>

Go to the `Network Access` section in the `security` tab. Click on `+ Add IP Address` to add an IP address, whereupon a new screen will pop up. Click the `Allow Access From Everywhere` button and `0.0.0.0/0` should appear in the `Whitelist Entry`. Otherwise, make sure to put input that manually. Finally, click `Confirm` to confirm your changes.<br>

<figure><img src="https://2270761089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft65ljAxhdyeMKMFD4OR5%2Fuploads%2FQjCzGYrVQarYozCUqsP9%2FELEVEN.png?alt=media&amp;token=32b895c3-8193-488b-88e9-88dcf245c3c2" alt=""><figcaption></figcaption></figure>

The last part is to generate a Mongo URI. Go to the `Clusters` section in the `Atlas` tab. Click on `Connect` on the left side of your Cluster dashboard. This will open up a new screen where you have three options. For our purposes, select the middle option `Connect Your Application.` <br>

<figure><img src="https://2270761089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft65ljAxhdyeMKMFD4OR5%2Fuploads%2Fidi6nduJQ74oE3Ydvgff%2FELEVEN.png?alt=media&amp;token=8f128094-efa9-4bc0-81cb-17a2ed0fbc29" alt=""><figcaption></figcaption></figure>

You need to copy the connection string, which can be easily done by clicking the `Copy` button. Remove everything past `<dbname>` but keeping the `/`. Then replace `<password>` with the password for your user and `<username>` with your database-username, which you set earlier. Paste the URI in your notepad.

The final URI looks similar to this:&#x20;

`mongodb+srv://Username:MyPassword@modmail-kjvn21.mongodb.net/.`<br>

<figure><img src="https://2270761089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft65ljAxhdyeMKMFD4OR5%2Fuploads%2FCy7i73KWBVECC1SBOoBe%2FTHIRTEEN.png?alt=media&amp;token=35493184-8a82-4c21-9384-332bce268f6a" alt=""><figcaption></figcaption></figure>
