What is NoSQL
MongoDB is a NoSQL database: instead of tables and rows, it stores documents (like JSON objects) in collections. More flexible than SQL but less structured. When to use SQL vs NoSQL: - SQL (PostgreSQL) → structured data, relationships, financial data - NoSQL (MongoDB) → flexible data, rapid prototyping, content
// MongoDB document (looks like JSON)
{
"_id": "64abc123",
"name": "Daniel",
"age": 20,
"skills": ["JavaScript", "Python"],
"address": {
"city": "Dallas",
"state": "TX"
}
}
// vs SQL table row
// id | name | age
// 1 | Daniel | 20
// (skills and address would be separate tables)