Setup Your Database

Cloudinary removes the need to develop and maintain complex image and media processing logic in-house. Enatega needs to run it for simplicity in operations.

1.1.

Sign up for a MongoDB Atlas Cluster

Download and Install MongoDB Tools

Configure Network Access Control

  • In Atlas, go to "Security > Network Access" and click "Add IP Address"

  • Allow your public IP address or address range access to the database

  • Create a MongoDB user for authentication during development

    1.4.

Install MongoDB Driver

  • Open the Enatega app folder in your code editor

  • Run npm install mongodb to install the MongoDB driver package

  • Import and instantiate the mongodb module in the app.js file

    1.5.

Create Database Schema

  • Design the schema structure for collections like Orders, Users etc.

  • Create model folders for each schema entity with its structure

  • Export each model to the app.js file

    1.6.

Connect to Cluster from App

  • Use the MongoDB URI from Atlas to connect to the cluster

  • Pass the schema models for data CRUD operations

  • Implement MongoDB methods like find(), insert(), update() etc.

    1.7.

Add CRUD Operations

  • Create routes and controller logic to support basic CRUD ops

  • Test routes by adding/fetching data from the MongoDB deployment

    1.8.

Implement Authentication

  • Add user authentication flows using middleware

  • Encrypt and store user passwords securely in the database

    1.9.

View Data in Compass

  • Download and open Compass to view database structure
  • Query and analyze sample data added during testing