🍃 Database

MongoDB vs MySQL — Which Database for Your Project?

📅 Jun 22, 2026 ⏱ 4 min read

The eternal fresher question. The honest answer: both are fine for most apps — but they think differently.

The mental models

-- MySQL: tables, rows, strict schema
students (id, name, dept_id)
depts    (id, name)          -- related via foreign keys + JOINs

// MongoDB: JSON-like documents, flexible schema
{
  name: "Priya",
  dept: "CSE",
  marks: [ { subject: "CN", grade: "A+" } ]   // nested — no JOIN needed
}

Choose MySQL/PostgreSQL when…

Choose MongoDB when…

Interview one-liner

"SQL databases scale vertically with strong consistency and joins; document stores trade schema rigidity for flexibility and horizontal scaling. I'd pick based on how relational the data is."

← All Articles