Skip to content

mongodb setup

Yash edited this page Jun 24, 2021 · 1 revision

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

Cluster selection

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.

Create a database user

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.

Create User

Whitelist all IP's

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.

Whitelisting IPs

Obtain a connection string

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.

Connection String

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, which you set earlier. Paste the URI in your notepad.

The final URI looks similar to this: mongodb+srv://Username:MyPassword@modmail-kjvn21.mongodb.net/.

Connection String - 2

Clone this wiki locally