MongoDB . We have a database!! Yeees

MEAN Day 5

On day 5 of the MEAN stack, we learn the database piece of the stack, the M. MongoDB is a NoSQl (not only sql) database. It uses JSON objects so no SQL needed. Today we created our first MongoDB and connected to our apps via Mongoose.

Databases are all about organization. They are about grabbing data and filing according to specific rules and guidelines. Well, at least that’s what I thought until today.

MongoDB is about flexibility and speed. It stores a JS object, called a document for each database “row”. That means, that’s each document can technically have their own fields and still be in the same collection (equivalent of sql table). So they are super flexible.

Without getting into too much detail (much of which I need to learn and review), we set up a MongoDB server, and then connected our database to our server with a great tool called mongoose. Mongoose gives our mongo database more functionality by helping us make models and schemas giving our DB a bit more structure. We then created some basic apps with a DB and displayed DB data in our ejs views. I kinda like it, although it is significantly more complex (in terms of joins etc) than the SQL databases we were working with before. There is definitely a big learning curve. I’ll leave it at that for now.


In algorithms we expounded in yesterday’s recursive flatten nested arrays, and went on to merging 2 arrays in ascending order. Ye, that’s super brief.


To be continued (my bus ride has come to an end 🙃

Have a good weekend, see you next week. As always, thanks for reading.