What I ❤️ About Mongo
Intro
I’ll start by saying I’m a huge fan of relational databases. So if you’d told me a year or two ago, I’d be writing an article about Mongo, I’d have been skeptical. But it turns out that MongoDB is awesome.
I was building a JSON aggregator and was planning to tackle it with Postgres
. Which is an awesome DB. The main things I hadn’t decided on was how much data to slam in a JSONB
column and how much to take out and put in columns to keep some kind of hybrid SQL & NoSQL DB. Postgres has some great GIN operators that are helpful with JSON. But they aren’t the solution to everything. But a friend suggested I look at Mongo and it automatically made a lot a sense. Store a JSON object as a document. So I set to getting into MongoDB.
Firstly, if you’re really interested in Mongo. Use the MongoDB University. Mongo run this and it’s fantastic. It’s got hand on courses using Vagrant
with challenges, quizzes and loads of great stuff that covers every aspect of Mongo. What better place to learn Mongo!
I love Mongo because it feels way more developer-y than SQL and it’s so flexible and powerful. Being so flexible means that it has a lot of options for problem solving. This is great but also confusing at times, which way of the 100s possible is correct. But following the courses are a great help.
These are my favorite aspects of Mongo
Super flexible
Mongo is very flexible, store your data however you want and what makes sense for your application. Reduce queries by embedding related data.
Model data in a more natural way
Documents express data structures in a far more comprehensible way, rather than scour through a massive schema
Great for prototyping
You just don’t need to worry about changing your schema or anything like that. Just change it and update your code and it just works
MongoDB Atlas
Get a managed DB at $0.
Scale easily
One of the main selling point of MongoDB is that it horizontally scales. Something RDBMS struggle to do. The replica set always enables high availability.
Aggregation framework
The aggregation framework is super powerful. It kind of works as conveyer belt of items that you filter objects out and transform them into different shapes as you move through the various stages. This makes MongoDB feel much more like a developer’s tool than a mean unto an end.
Mongo University
It’s an amazing source for idiomatic Mongo and a wealth of knowledge for developers and DBAs
Get Certified
If you want to put that university to good use then get a professional designation from MongoDB. I took this root and although I definitely found the test challenging, I’m really glad I did it