How to create a MongoDB URL in 10min ?
August 5, 2024 ยท View on GitHub
- Go to MongoDB website
(skip steps 2 and 3 if you already have an account, just create a new cluster) - On the account setup page, choose wisely your Organization name and Project name (you can't change that). Select Python as preferred language
- Choose
Create a clusteron theShared Clusterscategory (the free one) - Choose
Azureas provider andNetherlandsas region, then click onCreate Cluster(it takes 1-5 minutes, but don't close the window !) - When it's done, click on
Network Accesson left panelAdd IP AddressAllow access from anywhere(because Heroku IP addresses changes everytime)Confirm(it can take up to 2 minutes)
- Click on
Clusterson left panelConnect- Create a Database User (remember the credentials you choose !)
Choose a connection methodConnect with your application- Choose
Pythonas Driver - Choose
3.6 or lateras Version - Copy the URL
- Replace
<password>with the one you chosen at step 5.ii
You're done :partying_face:
Now use that as MONGODB_URL
Note
It should look like : mongodb+srv://username:password@cluster-name.abcde.mongodb.net/?retryWrites=true&w=majority
You can strip the DB name here, it's set on the MONGODB_DBNAME env var