In this video you're going to learn how to install Mongo D.B. on your machine.
That's going to allow you to start up the server locally and actually connect it to the database from
node j s so you can read and write data.
Now this video is for Windows users only if you're on Mac or Linux.
The last video was the installation video for you.
This one is just for my Windows users if you're still watching.
I am going to assume you're running on Windows to actually kick the process off.
What we're gonna do is head up to this link at the top right hand corner of Mongo D.B. dot com.
This is the get Mongo DB page where we can download what we need in this case from these three options.
We want to download a server so we can get Mongo D.B. up and running locally.
Now there are two options from here.
We have the Mongo DB community server and we have their enterprise server.
We'll be using the community server which is completely free and that's going to allow us to use Mongo
D.B. locally on our machines.
Now there are three options here.
The version the operating system and the package type you want to pick the most recent version of Mongo
D.B. available.
The current release even if it's greater than what you're seeing here for me which is four point zero
point four.
That's because I update these videos to support the latest version.
So make sure to grab that current release.
Next up the OS.
It should have automatically detected your Windows operating system inside of this dropdown there are
other OS is for Linux and for Mac here we do indeed want Windows and then down below we have our package
type and we're gonna go ahead and grab these zip archive which we'll be able to use to actually get
Mongo D.B. up and running.
Now you'll notice that there is no 32 bit version available but you can grab an older version of Mongo
D.B. in 32 bit if that's the operating system you're running on.
So for 64 bit users you have these options configured and you click the download button that's going
to grab the zip we need.
If you're running on Windows 32 bit you can head over to the following You are all that is Mongo D.B.
dot org forward slash DL forward slash win 32 forward slash AI 3 8 6.
When you visit this you're gonna be greeted with a very ugly page that contains the 32 bit versions
available with the most recent releases up top and the older releases down below you want to go to the
very top and you'll see two versions available for each.
The MSCI and the zip you want to grab these zip.
That's going to be what you need to install for 32 bit Windows.
So take some time to grab the correct zip for you.
And once it's done we're gonna go ahead and extract the contents of that archive.
So right here from the downloads folder we can move into the archive.
We can click extract and we can extract everything.
Now where do I want to put the extracted files.
I'm gonna put them right in the downloads directory.
So right here in my users folder forward slash downloads I'm going to extract them and right here it's
moving through the extraction process.
Now one of the things included in here is an executable that's going to allow us to start the server
up.
It also comes with a bunch of other executable is for doing other interesting things.
So at this point we have two things in the downloads folder.
I have the old archive and I have a folder when I open that folder I should see the following in there.
I have the bin directory.
So this is the folder that we're going to need to use because in there we have executable is for doing
things like starting our server up.
Now we don't want to leave this folder in the downloads directory.
We want to move it to a more permanent place on our machine before we do.
Let's go ahead and rename this folder right here.
I'm going to rename it from its current long name to something a bit simpler.
Mongo d be perfect.
Now that we have this in place let's go ahead and take this folder to a more permanent location.
What I'm going to do is put this on the user directory for my user profile so down below.
I have this P.C. in there I have all sorts of files and folders.
We're going to scroll down past that to a local disk right here we're cracking that open in there I
have users in there I have my user which is Andrew and that's where we're going to move this Mongo DB
directory.
So I'm going to take it and I'm going to move it over to that folder.
Now if I crack open the user directory I can see that Mongo D.B. is indeed listed right inside of here.
Now this contains what's needed to manage the server.
We also need to create a place to put the data that the database stores.
We're going to do this by creating a new folder right alongside of this one.
So I'm going to create a new directory.
I'm going to call this Mongo D.B. hyphen data that's going to set right alongside of the Mongo DB folder
and that's where we're going to store the data for the database.
With this in place we're now ready to actually start up the database from the terminal.
We're going to do that by using Visual Studio codes terminal right over here we have power shell running.
I'm going to start by using clear to clear the terminal output and the next thing we need to do is run
one of the executable is in that bin directory to get started.
We need to navigate to the executable that is going to be for me forward slash users forward slash my
user name in this case.
Andrew you can swap it out with yours.
Notice we're just starting with the path that we're seeing right here.
Then we're going to go into the folder we created and put in that directory which we had called Mongo
D.B. in there we have that bin folder and in there we have Mongo D dot e x e Mongo D is the executable
we're going to use to start up the server next up we're going to provide the hyphen hyphen DV path argument
which allows us to provide the path to the folder where the data should be stored and we just created
one for that.
That's forward slash users forward slash for me.
Andrew forward slash Mongo D.B. hyphen data.
Now if you chose to put these folders in different locations or you named them something else you're
gonna have to adjust your commands accordingly.
Right here though if I go ahead and hit enter it's going to actually start up the server for the very
first time.
Now we get a ton of output showing up.
The important thing though comes maybe five lines before the end.
Right here we have the following message waiting for connections on Pt. 2 7 0 1 7.
This is Mongo DB default port.
And by seeing this message it means that your server is up and running and it's waiting for connections.
For example connections from node j asked to read and write data.
Now if we navigate back over to the file explorer and open up that folder we created Mongo D.B. data.
You'll notice there's actually a lot of stuff inside of there.
Now this is all just boilerplate needed to get started.
None of it actually contains documents since we haven't created any just yet.
But as we move through this section and we start the process of adding documents to our collections
and storing those in our database all of that data is going to live inside of this directory.
So for the near future you're just going to leave this command up and running.
We can create multiple terminal tabs when we want to do other things like run our node J.S. applications.
But it is important to leave this running for as long as you want your database up and running which
for us is going to be for a while.
All right.
So that's where we're going to stop for this video.
We have Mongo D.B. running on our machine which is a great start in the next video.
You're actually going to connect to your database from node j s that's what's going to allow us to start
the process of reading and writing data.
I'm excited to get to that.
So let's go ahead and jump right in to the next one.