From the course: React: Creating and Hosting a Full-Stack Site

Why MongoDB?

"

- [Instructor] All right, so now that we've built out a very basic server using node JS and Express for our full stack application, the next thing that we're going to do is see how to persist our data in a database. Now, since both our client and server side are written in JavaScript, it makes sense to persist our data in a database that plays very nicely with JavaScript and has a similar format to the kind of data that we want to store. And for that, we don't need to look any further than MongoDB. Now, MongoDB is what's called a non-relational database, and basically what this means is that we can just sort of push JavaScript data into it without worrying too much about how that data is formatted. Now, in the case of MongoDB, what we can do is simply hand our database any kind of JSON that we want, and it will just store that for us and allow us to retrieve them later whenever we need them. All right, now this is in pretty stark contrast to some of the traditional relational databases, such as SQL-based databases like MySQL, where the structure of the data and the fields that it contains have to generally be defined in advance and adhered to whenever we add new data. All right, so working with relational databases also generally requires some knowledge of SQL, of course, and so by using this, we would sort of fall short of our ideal of being able to write our full stack application using only JavaScript. So anyway, that's MongoDB, and that's why we're going to be using it here. So let's get started and see how to add this to our app.

Inhalt