Connect to MongoDB Atlas

Mongo DB Atlas is a fully-managed database-as-a-service available on AWS, Azure, and GCP  
Before to start, you need to signup here.

First of all, you need to create a new cluster and choosing the FREE offert ðŸ˜Ž

 

 TipsFor best performance, please choose eu-west-1 region.


You can start to configure with the assistant that appears at the bottom left of your screen or by following the documentation.


For this article, we have created a database called 'db_one' as well as a collection called 'collection_one'



On your cluster, click on the 'Connect' button and choose 'Connect your application'.




Create a new API function of type Node.js in your cloud backend : 






Click on the  button and install mongoDB NPM package
Also, we will use async function so you will need to activate it also.





Then, copy the connection string into your function API  and write your code in order to get all datas from our collection 'collection_one'


See the Pen MongoDBAtlas by David (@DavidAppdrag) on CodePen.


 
📘  Note : We can also insert and delete datas in your collection from your function
 

Click on  button and then  :