Creating a MongoDb account
Prerequisites
Gmail account.
Sign up
Visit https://account.mongodb.com/account/register .
Choose Sign up with Google
Choose the Gmail account you want to use for signing up.
Accept privacy policy and terms of service
You will be asked to name your organization and project ( in lack of better idea it is safe to accept the defaults )
Select your preferred programming language, then press Continue
Create a FREE cluster
Edit your account details ( it is safe to accept defaults ), then press Create Cluster
Setting up database
From the Get Started guide select Create your first database user
Click on Database Access
Click on Add New Database User
For Authentication Method select “Password”, and enter a username ( consisting of only small cap letters, don’t use any special characters, YoBot_v2
not good, yobotversiontwo
good ) and password ( in the image a password containing special characters was typed in manually, which is not a good idea, because this needs url encoding due to special characters, so it is safest to press Autogenerate Secure Password and SHOW / Copy this auto generated password )
From Database User Privileges select Atlas admin, then press Add User
You can add further users to your database by pressing ADD NEW DATABASE USER, but we will be content with one user
Click on Network Access
Click on Add IP Address
Select Allow access from anywhere then press Confirm
From the Get Started guide select Connect to your cluster, then press Connect
Obtaining MONGODB_URI
Select Connect your application
Copy your connection string and replace the password with your database user’s password, delete everything from /dbname onward, you won’t need this.
Setting MONGODB_URI
Heroku config var for Hyper Bot
If you copied
mongodb+srv://hyperchessbot:<password>@cluster0.bv7tb.mongodb.net/<dbname>?retryWrites=true&w=majority
edit it to
mongodb+srv://hyperchessbot:youractualpassword@cluster0.bv7tb.mongodb.net
and save this as a Heroku config var under the key MONGODB_URI
.
Of course instead of hyperchessbot you need your actual database user name ( but this will be filled in for you, when you copy ) and insteat of youractualpassword you need your generated secure password.
There should be no forward slash at the end of MONGODB_URI
!