DEV Community

SRIRAM PG
SRIRAM PG

Posted on

MONGO-DB

MongoDB CRUD Operations - Student Database

In this assignment, we explored MongoDB CRUD (Create, Read, Update, Delete) operations using a simple students collection.


Schema

Each student document follows this structure:

{
  "student_id": "S001",
  "name": "Santhosh",
  "age": 20,
  "department": "CSBS",
  "year": 2,
  "cgpa": 9
}
Enter fullscreen mode Exit fullscreen mode

Tasks Performed

🔹 Create

Inserted 5 student records using insertMany().

🔹 Read

  • Display all student records
  • Find students with CGPA > 8
  • Find students from CSE / CSBS department

🔹 Update

  • Updated CGPA of a student (S002)
  • Increased year of all 3rd year students by 1

🔹 Delete

  • Deleted one student by student_id
  • Deleted all students with CGPA < 7.5

Output

Screenshots were taken from MongoDB Atlas for execution results.
Finally, the collection was exported in JSON/CSV format for submission.


✅ This assignment gave us hands-on practice with MongoDB’s document model and CRUD operations.

Top comments (0)