- [Instructor] Okay, so now that we've got
a working server written for Node.js,
the next thing we're going to look at doing
is adding a database to our server.
Now, since both our client and server
are now written in JavaScript,
it makes sense to persist our data in a database
that plays very nicely with JavaScript.
And for that, we need to look no further than MongoDB.
MongoDB is what we call a non-relational database,
which means that we can basically just push data into it
without worrying too much about how that data is formatted.
In the case of MongoDB,
we can simply hand our database any kind of JSON objects
that we want it to store
and we can retrieve them later whenever we need them.
And this is in contrast to traditional relational databases
where the structure of the data
and the fields that it contains
has to be generally defined in advance
and adhered to whenever we add new data.
And also, working with relational databases
generally requires some knowledge of SQL,
so we would fall short of our ideal
of writing a full-stack application using only JavaScript.
Now I know plenty of people who still swear by using SQL
and I'm not here to tell you that either
MongoDB or SQL databases are better in all cases,
but for our purposes,
for the purpose of quickly building and releasing
a full-stack JavaScript application,
MongoDB is definitely going to make our lives easier,
so that's what we're going to use for our site.