← all posts

BACKEND

Why I Stopped Being Scared of Databases

Apr 26·MongoDB·5 min read

I remember staring at my first MongoDB schema like it owed me money.

No tables. No joins. No rules. Just... objects? Nested inside other objects? I'd spent months getting comfortable with SQL — knowing exactly where everything lived — and now I was supposed to just wing it?

So I did what any reasonable developer does: I avoided it for three months.

The moment it clicked

The shift happened when I stopped thinking "how do I store this?" and started thinking "how will I use this?"

SQL thinks in tables. MongoDB thinks in answers. If your app always asks "give me this user and all their posts," MongoDB says — just put the posts inside the user. Done. No join. No second query. No headache.

That's not laziness. That's the whole point.

What frontend devs actually get wrong

Coming from React, I already thought in components — small, self-contained units of data and logic. MongoDB documents are the same idea, just for your database layer.

The mistake most frontend devs make is trying to normalize everything like SQL. Separate collections for everything, references everywhere. Then they wonder why every query needs five lookups.

Rule of thumb: If you always fetch it together, store it together.

The part nobody warns you about

Schemas. Or the lack of them. MongoDB doesn't enforce structure — which feels like freedom until you have 4,000 documents where half have userName and half have username. Use Mongoose or Zod to validate your data before it hits the database. Trust me on this one.

Where I am now

Databases aren't scary anymore. They're just opinions about where your data lives. SQL is great. MongoDB is great. The best one is the one that matches how your app thinks.

Start with the question your app needs to answer. Then design backward from there. That's it. That's the whole secret.

Thanks for reading.Next: The React Mental Model Nobod… →