Welcome to the start of a new section and to this start of a new project the task manager project.
Now in this video in particular we're gonna talk about the database we'll be using to store our user
data that is Mongo D.B..
So for this new project we're gonna have an authentication system and we're going to need a more robust
solution than just storing all of our data in a Jason File like we had done for the notes application.
Now before we dive in and actually explore this database I want to do a little bit of housekeeping.
I'm gonna close all open editors in Visual Studio code and I'm also going to collapse that web server
directory since we're done with that and we're gonna move on to a new project from the terminal.
We can use control C to shut down node mine and I'll use it C D dot dot to navigate out of the web server
folder back to the node course directory.
From here we can use clear to clear the terminal output.
And now we have a nice clean space for starting our new project.
From here we're going to move into the browser and do something similar.
I'm going to close all four tabs related to the weather application.
That was the github tab.
The Heroku tab that our local and production version of the application I can leave open the chrome
inspect tab though in case we need to use that.
And from here we're gonna crack open a new tab and to start we're going to explore the database we'll
be using to store all of our user data that is Mongo D.B. we can find Mongo D.B. on the web.
Over at Mongo D.B..
Dot com.
Now Mongo D.B. is an open source database and it's also available for old operating systems.
So whether you're running on Windows Mac or Linux you're gonna be able to install the database and get
it running on your machine.
And that's exactly what we'll end up doing in the next couple of videos from there.
We'll be able to use the Mongo D.B. native driver to connect to our database from node j s and we'll
be able to start the process of writing and reading data.
Now Mongo D.B. was originally launched in 2009 which as you'll remember is the same year when no J.S.
was first launched.
Now the timing here is merely coincidental but the no GSK community definitely fell in love with Bongo
D.B. and it became the database of choice for many no J S developers.
Now it's important to note that no J ust isn't exclusive to mongo DB in any way whatsoever.
You can use Mongo D.B. in other programming languages and you can use other databases with no to J S
you could use as an example.
Might ask you well or post graphs with no J yes as well but we have to pick something and Mongo DB is
a great choice for node j s developers.
We'll learn more about why it's a great choice as we actually start to use it in this section.
If you've worked with a database before it's possible you worked with an S Q L database.
This would include a very popular database solutions like my S Q Well and post grass.
Now Mongo D.B. falls under a different category of database called a no ask you l database Eskew L stands
for the Structured Query Language and no less Q L stands for not only structured query language.
Now the actual usage of Mongo D.B. is going to look a bit different than what you'd see if you were
using an ESC You l database but it's going to provide us with a structured way to store and interact
with our data.
Mongo D.B. also provides no J S developers with NPM module that can easily be used to read and write
from the database.
Now to wrap up this video what I want to do is move into a quick visualization that's going to compare
and contrast both Eskew L and no s.
Q L databases at a high level and in the next couple of videos will actually start the process of installing
this on our machine and connecting to it from node j s or this comparison.
We'll put our Eskew El database on the left hand side and we'll put our no Eskew l database in this
case.
Mongo D.B. over here on the right now many of the concepts are identical in both but some are slightly
different or at least have different names and the goal here is for us to build up a vocabulary for
no Eskew well that we can use as we're integrating Mongo D.B. into our node j s applications.
Let's start with an easy comparison.
The concept of a database.
Both have them and with Mongo D.B. we can create as many databases as our application needs and we'll
learn how to do that in just a few videos so we can easily create one database for one application and
then we could create other databases for our other apps.
Now from here we start to talk about exactly how the data is stored and that's where we start to see
some differences between the Eskew El database on the left and know Eskew well database on the right
for the Eskew El database your data is stored in this which is known as a table your database could
have as many tables as you need for your application.
So you might have one table to store your user data and another to store the various tasks that your
users need to complete right here.
Each user has an I.D. a name an email and a password and I have an example user down below.
Now we're also storing data in our no Eskew databases but it looks a bit more like this and I no S Q
L vocabulary it's referred to as a collection you know Eskew l database can have as many collections
as it needs so as with the example from our s fuel database you might have one collection which stores
a list of users in your application and you might have a second collection which stores a list of tasks
that your users need to complete.
Now when it comes to describing the actual data what we're seeing here we have a different set of terms
between the two.
How do we describe the individual items being stored in either the table or the collection in S Q Well
this is known as a row or a record.
So here I could say I have a user's table with a single record meaning that there is one entry inside
of there inside of a no ask you l database we have what are known as documents and you can see a document
right here highlighted in blue documents look a whole lot like Jason.
So we have Rosen records and we have documents.
What about the individual things stored inside of there for at S Q L database.
This is known as a column.
So here I can say I have a user table with four columns I.D. name email and password in a no Eskew l
database like Mongo D.B. these are just known as fields.
So here I could say this document has four fields I d name email and password.
So it's really important to understand the basic vocabulary for a no Eskew l database so we can actually
start to use it and have conversations about Mongo D.B. with all of us being on the same page as to
what a collection is what a document is and what a field is a collection is a list of injuries those
individual entries are referred to as documents and a document can have as many fields as you need your
users collection might have four fields for each user while a different collection for something like
tasks would have a completely different set of fields for each document and we'll learn how to set all
of that up as we progress through the class that's where we're going to stop for this video now that
we have some basic vocab locked down it's time to move on to the next two videos which are going to
be installation videos where we're going to get Mongo D.B. setup there is one installation video for
Mac and Linux and there's a separate one for Windows users let's go ahead and jump right in.