This course has been updated! We now recommend you take the API Design in Node.js, v4 course.
Transcript from the "MongoDB" Lesson
[00:00:00]
>> Scott Moss: All right, MongoDB. Its basically the goal to non-relational DB and for me it just works so well. Its like, its a given. It's the first database that I learned how to use. It's not the the only that I used but its just so easy. Especially the tools that come with it.
[00:00:20] So it's a non-relational document store. So to compare that to a relational database, and I'm sure most of you have used Postgres or SQL. It's not relational, so basically what that means is it doesn't really care about how data relates to each other. It's basically just storing JSON in a blob like here you go.
[00:00:38] In Postgres you can store a JSON now. So imagine it like, the whole database is like that, you could just store JSON. So that might seem scary, because it is, because you can do that, that doesn't mean you should do that. That's just what Mongo allows you to do, is just throw this data in here, and just be free.
[00:00:56] But that doesn't mean you should do it. I highly recommend not doing that, and we'll talk about that later. But it does make it easy to get started because it is like that and you don't have to define different lists of columns and things like that. You can just throw JSON in your database.
[00:01:12] It is open source and it's backed by the company that created it, the MongoDB company, or whatever their name is. But yeah, they're called MongoDB, they're like a public company and they have tons of products. So it's not going there anytime soon like other databases that have come and go.
[00:01:27] So it's gonna be here for a while. Like I said, as far as non-relational databases go, it's definitely the biggest one. And I don't think it's gonna go anywhere any time soon. Tons of hosting solutions, I talked about one earlier. MLAB is one. Compass is another one. The people who created MongoDB, Atlas, is another one.
[00:01:46] And there's more popping up every day. I'm sure Atlas is probably gonna buy them all, but they're popping up. So yeah, you have tons of solutions whether if you're on AWS, if you're on DigitalOcean, if you're on, wherever you're hosting your stuff, there's going to be options for you to get some cloud hosting for MongoDB.
[00:02:02] If not, it's open source, you can host it yourself. If you want to manage it, your own replica sets and do all that stuff, you can totally do it. It's open source. Everything is there.
>> Scott Moss: One of my favorite things about MongoDB that we're gonna be using in this course is the ORM, or ODM is what they call it.
[00:02:20] So the object relational mapper or their object data modeler, or object data mapper, whatever that stands for. But it's basically the JavaScript representation of how we interact with the models in the database. If you have an orm for SQL or postgres, this is the equivalent of that but in mongo and it's called Mongoose, or at least that's the one that we're gonna be using.
[00:02:40] There's tons of them, but that's the one that we're going to use it because it's the best one. And it's so good that a lot of databases actually copy its API, like I've seen so many database copy the API of Mongoose, like this is really cool we're gonna copy this and it's really that good.
[00:02:57] So I like it.