1 00:00:00,450 --> 00:00:05,020 In this video you're going to learn how to install Mongo D.B. on your machine. 2 00:00:05,130 --> 00:00:10,020 That's going to allow you to start up the server locally and actually connect it to the database from 3 00:00:10,020 --> 00:00:13,500 node j s so you can read and write data. 4 00:00:13,500 --> 00:00:17,910 Now this video is for Windows users only if you're on Mac or Linux. 5 00:00:17,910 --> 00:00:21,260 The last video was the installation video for you. 6 00:00:21,270 --> 00:00:24,870 This one is just for my Windows users if you're still watching. 7 00:00:24,900 --> 00:00:30,120 I am going to assume you're running on Windows to actually kick the process off. 8 00:00:30,120 --> 00:00:36,250 What we're gonna do is head up to this link at the top right hand corner of Mongo D.B. dot com. 9 00:00:36,270 --> 00:00:43,420 This is the get Mongo DB page where we can download what we need in this case from these three options. 10 00:00:43,440 --> 00:00:48,790 We want to download a server so we can get Mongo D.B. up and running locally. 11 00:00:48,810 --> 00:00:50,770 Now there are two options from here. 12 00:00:50,790 --> 00:00:55,850 We have the Mongo DB community server and we have their enterprise server. 13 00:00:55,950 --> 00:01:01,590 We'll be using the community server which is completely free and that's going to allow us to use Mongo 14 00:01:01,590 --> 00:01:04,140 D.B. locally on our machines. 15 00:01:04,140 --> 00:01:05,780 Now there are three options here. 16 00:01:05,820 --> 00:01:13,140 The version the operating system and the package type you want to pick the most recent version of Mongo 17 00:01:13,140 --> 00:01:14,340 D.B. available. 18 00:01:14,340 --> 00:01:19,860 The current release even if it's greater than what you're seeing here for me which is four point zero 19 00:01:19,890 --> 00:01:20,930 point four. 20 00:01:20,940 --> 00:01:24,390 That's because I update these videos to support the latest version. 21 00:01:24,450 --> 00:01:27,160 So make sure to grab that current release. 22 00:01:27,180 --> 00:01:28,700 Next up the OS. 23 00:01:28,740 --> 00:01:34,500 It should have automatically detected your Windows operating system inside of this dropdown there are 24 00:01:34,500 --> 00:01:41,610 other OS is for Linux and for Mac here we do indeed want Windows and then down below we have our package 25 00:01:41,610 --> 00:01:47,490 type and we're gonna go ahead and grab these zip archive which we'll be able to use to actually get 26 00:01:47,490 --> 00:01:49,460 Mongo D.B. up and running. 27 00:01:49,470 --> 00:01:56,040 Now you'll notice that there is no 32 bit version available but you can grab an older version of Mongo 28 00:01:56,040 --> 00:02:00,450 D.B. in 32 bit if that's the operating system you're running on. 29 00:02:00,450 --> 00:02:06,390 So for 64 bit users you have these options configured and you click the download button that's going 30 00:02:06,390 --> 00:02:08,280 to grab the zip we need. 31 00:02:08,520 --> 00:02:16,380 If you're running on Windows 32 bit you can head over to the following You are all that is Mongo D.B. 32 00:02:16,440 --> 00:02:25,760 dot org forward slash DL forward slash win 32 forward slash AI 3 8 6. 33 00:02:25,860 --> 00:02:32,370 When you visit this you're gonna be greeted with a very ugly page that contains the 32 bit versions 34 00:02:32,400 --> 00:02:38,940 available with the most recent releases up top and the older releases down below you want to go to the 35 00:02:38,940 --> 00:02:42,260 very top and you'll see two versions available for each. 36 00:02:42,270 --> 00:02:45,900 The MSCI and the zip you want to grab these zip. 37 00:02:45,900 --> 00:02:50,280 That's going to be what you need to install for 32 bit Windows. 38 00:02:50,280 --> 00:02:53,610 So take some time to grab the correct zip for you. 39 00:02:53,610 --> 00:02:58,860 And once it's done we're gonna go ahead and extract the contents of that archive. 40 00:02:58,860 --> 00:03:03,870 So right here from the downloads folder we can move into the archive. 41 00:03:03,870 --> 00:03:07,610 We can click extract and we can extract everything. 42 00:03:07,650 --> 00:03:10,340 Now where do I want to put the extracted files. 43 00:03:10,350 --> 00:03:13,170 I'm gonna put them right in the downloads directory. 44 00:03:13,170 --> 00:03:21,540 So right here in my users folder forward slash downloads I'm going to extract them and right here it's 45 00:03:21,540 --> 00:03:24,090 moving through the extraction process. 46 00:03:24,090 --> 00:03:29,880 Now one of the things included in here is an executable that's going to allow us to start the server 47 00:03:29,880 --> 00:03:30,390 up. 48 00:03:30,390 --> 00:03:35,210 It also comes with a bunch of other executable is for doing other interesting things. 49 00:03:35,250 --> 00:03:38,640 So at this point we have two things in the downloads folder. 50 00:03:38,700 --> 00:03:44,800 I have the old archive and I have a folder when I open that folder I should see the following in there. 51 00:03:44,850 --> 00:03:46,820 I have the bin directory. 52 00:03:46,950 --> 00:03:52,110 So this is the folder that we're going to need to use because in there we have executable is for doing 53 00:03:52,110 --> 00:03:54,550 things like starting our server up. 54 00:03:54,600 --> 00:03:57,990 Now we don't want to leave this folder in the downloads directory. 55 00:03:57,990 --> 00:04:02,400 We want to move it to a more permanent place on our machine before we do. 56 00:04:02,610 --> 00:04:05,660 Let's go ahead and rename this folder right here. 57 00:04:05,850 --> 00:04:10,380 I'm going to rename it from its current long name to something a bit simpler. 58 00:04:10,380 --> 00:04:13,010 Mongo d be perfect. 59 00:04:13,140 --> 00:04:18,020 Now that we have this in place let's go ahead and take this folder to a more permanent location. 60 00:04:18,030 --> 00:04:23,900 What I'm going to do is put this on the user directory for my user profile so down below. 61 00:04:23,970 --> 00:04:28,730 I have this P.C. in there I have all sorts of files and folders. 62 00:04:28,770 --> 00:04:34,800 We're going to scroll down past that to a local disk right here we're cracking that open in there I 63 00:04:34,800 --> 00:04:41,130 have users in there I have my user which is Andrew and that's where we're going to move this Mongo DB 64 00:04:41,220 --> 00:04:42,210 directory. 65 00:04:42,210 --> 00:04:46,380 So I'm going to take it and I'm going to move it over to that folder. 66 00:04:46,380 --> 00:04:53,000 Now if I crack open the user directory I can see that Mongo D.B. is indeed listed right inside of here. 67 00:04:53,010 --> 00:04:56,360 Now this contains what's needed to manage the server. 68 00:04:56,370 --> 00:05:01,120 We also need to create a place to put the data that the database stores. 69 00:05:01,200 --> 00:05:05,630 We're going to do this by creating a new folder right alongside of this one. 70 00:05:05,700 --> 00:05:10,490 So I'm going to create a new directory. 71 00:05:10,740 --> 00:05:19,740 I'm going to call this Mongo D.B. hyphen data that's going to set right alongside of the Mongo DB folder 72 00:05:19,980 --> 00:05:23,310 and that's where we're going to store the data for the database. 73 00:05:23,310 --> 00:05:27,920 With this in place we're now ready to actually start up the database from the terminal. 74 00:05:27,960 --> 00:05:34,280 We're going to do that by using Visual Studio codes terminal right over here we have power shell running. 75 00:05:34,440 --> 00:05:40,920 I'm going to start by using clear to clear the terminal output and the next thing we need to do is run 76 00:05:41,010 --> 00:05:44,810 one of the executable is in that bin directory to get started. 77 00:05:44,840 --> 00:05:51,810 We need to navigate to the executable that is going to be for me forward slash users forward slash my 78 00:05:51,840 --> 00:05:53,340 user name in this case. 79 00:05:53,340 --> 00:05:55,900 Andrew you can swap it out with yours. 80 00:05:55,920 --> 00:05:59,570 Notice we're just starting with the path that we're seeing right here. 81 00:05:59,760 --> 00:06:05,460 Then we're going to go into the folder we created and put in that directory which we had called Mongo 82 00:06:05,490 --> 00:06:14,760 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 83 00:06:14,790 --> 00:06:21,690 we're going to use to start up the server next up we're going to provide the hyphen hyphen DV path argument 84 00:06:21,960 --> 00:06:27,330 which allows us to provide the path to the folder where the data should be stored and we just created 85 00:06:27,330 --> 00:06:28,310 one for that. 86 00:06:28,500 --> 00:06:32,540 That's forward slash users forward slash for me. 87 00:06:32,550 --> 00:06:37,490 Andrew forward slash Mongo D.B. hyphen data. 88 00:06:37,580 --> 00:06:42,480 Now if you chose to put these folders in different locations or you named them something else you're 89 00:06:42,480 --> 00:06:45,570 gonna have to adjust your commands accordingly. 90 00:06:45,570 --> 00:06:50,970 Right here though if I go ahead and hit enter it's going to actually start up the server for the very 91 00:06:50,970 --> 00:06:52,200 first time. 92 00:06:52,230 --> 00:06:54,960 Now we get a ton of output showing up. 93 00:06:54,960 --> 00:06:59,030 The important thing though comes maybe five lines before the end. 94 00:06:59,040 --> 00:07:06,210 Right here we have the following message waiting for connections on Pt. 2 7 0 1 7. 95 00:07:06,300 --> 00:07:08,670 This is Mongo DB default port. 96 00:07:08,910 --> 00:07:14,440 And by seeing this message it means that your server is up and running and it's waiting for connections. 97 00:07:14,490 --> 00:07:19,580 For example connections from node j asked to read and write data. 98 00:07:19,590 --> 00:07:26,740 Now if we navigate back over to the file explorer and open up that folder we created Mongo D.B. data. 99 00:07:26,760 --> 00:07:29,550 You'll notice there's actually a lot of stuff inside of there. 100 00:07:29,550 --> 00:07:32,540 Now this is all just boilerplate needed to get started. 101 00:07:32,550 --> 00:07:37,270 None of it actually contains documents since we haven't created any just yet. 102 00:07:37,470 --> 00:07:43,380 But as we move through this section and we start the process of adding documents to our collections 103 00:07:43,380 --> 00:07:49,510 and storing those in our database all of that data is going to live inside of this directory. 104 00:07:49,530 --> 00:07:53,760 So for the near future you're just going to leave this command up and running. 105 00:07:53,760 --> 00:08:00,660 We can create multiple terminal tabs when we want to do other things like run our node J.S. applications. 106 00:08:00,780 --> 00:08:06,180 But it is important to leave this running for as long as you want your database up and running which 107 00:08:06,180 --> 00:08:08,810 for us is going to be for a while. 108 00:08:08,820 --> 00:08:09,530 All right. 109 00:08:09,570 --> 00:08:12,030 So that's where we're going to stop for this video. 110 00:08:12,060 --> 00:08:17,600 We have Mongo D.B. running on our machine which is a great start in the next video. 111 00:08:17,640 --> 00:08:23,730 You're actually going to connect to your database from node j s that's what's going to allow us to start 112 00:08:23,730 --> 00:08:26,480 the process of reading and writing data. 113 00:08:26,490 --> 00:08:28,000 I'm excited to get to that. 114 00:08:28,020 --> 00:08:30,690 So let's go ahead and jump right in to the next one.