HTTP Access to MongoDB Database With Data API

Recently MongoDB Atlas has launched Data API that enable developer to perform CRUD operations over HTTP, this service allow us to serve data to frontend directly from MongoDB database without any additional drivers or libraries needed. The use of Atlas Data API could significantly improve developer productivity as well as user experience, why so? let’s take an example of e-commerce website.

One of the most important feature in e-commerce website is shopping cart, customer uses it very often and sometimes left it as it is for a quite long time before proceed to checkout. While cart is essential, it’s store temporary data and must be available anywhere for every customer, so if an item was added to cart from web/desktop today it should still be there on app/mobile three days later (some e-commerce website store it for 30 days max). According to this requirement, we need backend to store and retrieve data from database.

By storing shopping cart data directly into NoSQL database backend developers can focus on another important features and frontend developers can release shopping cart feature independently since they no longer needed save-to-cart endpoint. Frequent request for add-update-delete item in shopping cart will not burden backend server but routed to NoSQL database cluster instead.

Enable Data API

Enable Data API

Create Data API Key

Create API Key

Please note that we should not embed API key directly in our client application to prevent security breaches, we can use either API gateway or function compute to route request to Data API and append api-key into request header.

Make a Test Request

Data API Response



enterprise architect. tech enthusiast. coffee addict.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store