test

Constatic

Discord Bot BaseDatabases

MongoDB

Guide to create a new mongodb database

Creating a MongoDb Database

Visit https://www.mongodb.com/pt-br and log in (or register).

test

You should be sent to the home page. If not, click the Atlas logo at the top of the page After that, click on New Project to create a new project

test

Enter the name you want and click Next

test

You will see this screen, so just click Create Project

test

You will be redirected to your project home screen

Initially you will have nothing, so click Create

test

Choose the M0 free plan

test

Choose the provider you want, then select the region (It is recommended to choose the one closest to your application). Enter whatever name you prefer for the cluster.

test

At the bottom of the page click Create

test
  • ⚠️ This step is very important

Create a user to be able to access the database! Set the name you want and the password (It is recommended to click to generate the password automatically).

  • ⚠️ Click to copy this password and save it for later use Keep scrolling down the page and you will reach the last step
test

Add an IP address and click Add Entry Adding the IP 0.0.0.0/0 will allow your bot that is hosted anywhere to connect to the database

Lastly click on Finish and Close

test

Click Connect

test

Then select Drivers

test

Click to copy your database URI

test

Note that right below it says to replace <password> with the password you defined for your user

  • mongodb+srv://root:<password>@cluster0.doy8zej.mon...
  • mongodb+srv://root:T8g4Hrlqi7LUK0XG@cluster0.doy8zej.mon...

With your database URI in hand, you can now use it in your projects to connect.

Define it in the .env file

test

On this page