Posts

Showing posts from August, 2025

What is MongoDB & How to Install and use it

Image
  MongoDB is a NoSQL database that stores data in a flexible, JSON-like format called BSON (Binary JSON).  Unlike traditional relational databases like MySQL or PostgreSQL, which use tables and rows,  MongoDB uses collections and documents . Key Concepts Concept Description Database A container for collections. Collection A group of documents, similar to a table in SQL. Document A single record in a collection, stored as a JSON-like object.   Example of a document: { "name" : "Alice" , "age" : 30 , "email" : "alice@example.com" } Download it from :- https://www.mongodb.com/try/download/community for windows :- and after installation open it :- and create connection and connect it for example enter connection name as omsir :- and then connect it :- and then you will see following here just click on local you wi...

Express js crud tutorial with mongodb and ejs frontend

Image
Express.js CRUD application  with: MongoDB (Mongoose)  backend Video & PDF upload Course and Lecture model EJS frontend templates Open command prompt and create project folder by using following commands :- mkdir  course-app cd  course-app and then type :- npm init -y and then   Install dependencies npm install express mongoose multer ejs dotenv method-override then you will see your project folder like this :- create config folder and create following file:- File Upload Setup multer.js  file code:- const multer = require('multer'); const path = require('path'); const storage = multer.diskStorage({   destination: function (req, file, cb) {     cb(null, 'public/uploads/');   },   filename: function (req, file, cb) {     cb(null, Date.now() + path.extname(file.originalname));   } }); module.exports = multer({ storage: storage }); and create .env file :- MONGO_URI=mongodb://localhost:27017/courseApp s...

Express js Crud for adding courses and lectures with video upload and pdf notes with backend mongodb and front end in ejs

Image
   Express js Crud for adding courses and lectures with video upload and pdf notes with backend mongodb and front end in ejs Here's a full  Express.js CRUD application  with: MongoDB (Mongoose)  backend Video & PDF upload Course and Lecture model EJS frontend templates open your command prompt in windows :- and create  project folder as "course-app "  mkdir  course-app  cd  course-app npm init -y Then Install dependencies npm install express mongoose multer ejs dotenv method-override Project Structure :- course-app/ │ ├── public/ │   └── uploads/               # Stores videos & PDFs │ ├── views/ │   ├── courses/ │   │   ├── index.ejs │   │   ├── new.ejs │   │   └── show.ejs │   ├── lectures/ │   │   ├── new.ejs │   └── layout.ejs │ ├── models/ │   ├── Course.js │...