WEBVTT 0 00:00.150 --> 00:07.290 First things first. Head over to mongodb.com and we're going to click on get MongoDB to download 1 00:07.290 --> 00:07.910 it. 2 00:08.010 --> 00:13.740 Now you should be taken to the MongoDB download center and the first tab that's usually selected by 3 00:13.740 --> 00:16.290 default is their cloud service 4 00:16.320 --> 00:22.590 so the MongoDB Atlas service which we're going to explore a little bit later on when we actually deploy 5 00:22.590 --> 00:23.410 our database. 6 00:23.580 --> 00:26.010 But for now we want to choose the service tab. 7 00:26.340 --> 00:30.430 And down here you should have your Windows version already pre-selected 8 00:30.660 --> 00:35.630 and we're going to select the current version of MongoDB. 9 00:35.790 --> 00:40.160 Now it's really important that you change this package from zip to MSI 10 00:40.440 --> 00:45.750 because this is going to download a installation wizard and it'll make everything a lot easier for us 11 00:45.990 --> 00:47.010 going forward. 12 00:47.010 --> 00:55.210 So once you're done here then just go ahead and click download and now download should begin. 13 00:55.210 --> 01:01.180 Now once download is completed you should be able to head into your Downloads folder and see this installation 14 01:01.180 --> 01:01.910 wizard. 15 01:01.930 --> 01:04.060 It's going to be called something like mongodb 16 01:04.060 --> 01:05.580 something something something 17 01:05.650 --> 01:07.130 .msi. 18 01:07.300 --> 01:09.920 And this is going to be your installer. 19 01:10.060 --> 01:16.240 And so now if you double click on it it will launch the installation wizard and all you have to do is 20 01:16.240 --> 01:17.400 click next. 21 01:17.530 --> 01:23.500 And then we're going to accept the terms of the license and we're going to choose the complete installation 22 01:23.890 --> 01:31.480 and then you're going to select Run service as a network service user and make note of this directory 23 01:31.480 --> 01:33.850 path that they've created here for you. 24 01:33.850 --> 01:40.250 This is where they're going to install MongoDB. It's going to be on the C:\Program Files/MongoDB/ 25 01:40.250 --> 01:43.320 server\4.0. 26 01:43.600 --> 01:49.460 And I recommend keeping to this exact same file path because we'll need a little bit later on. 27 01:49.630 --> 01:54.460 So keep it the same and keep a note of it and we're going to come back to it a little bit later on. 28 01:54.460 --> 01:59.800 So then you're going to select next and we're going to uncheck install MongoDB compass because 29 01:59.800 --> 02:01.210 we don't actually need it. 30 02:01.450 --> 02:06.640 And then click next and finally click install to start the installation. 31 02:07.870 --> 02:15.030 And once installation has complete simply click Finish and you'll exit out of the installation wizard. 32 02:15.240 --> 02:15.510 All right. 33 02:15.510 --> 02:22.080 So now that we've successfully installed MongoDB using the installer, if you now go into your C-drive 34 02:22.170 --> 02:29.040 and you take a look at your program files you should see a folder called MongoDB and inside there's something 35 02:29.040 --> 02:29.980 called server 36 02:30.030 --> 02:33.330 and then there's the version of the MongoDB that you installed. 37 02:33.330 --> 02:36.350 and then finally we get access to our binaries. 38 02:36.630 --> 02:42.330 Now the next thing I want to do is I'm going to set up the data folder where MongoDB will save our 39 02:42.330 --> 02:44.950 databases on our local system. 40 02:45.000 --> 02:48.020 So I want you to go ahead into your C drive, 41 02:48.180 --> 02:53.580 so make sure that up here says your C drive, and then you're going to create a new folder here and it's going 42 02:53.580 --> 02:55.260 to be called data. 43 02:55.410 --> 03:00.810 And then inside that data folder we're going to create a new folder called db and just make sure that 44 03:00.810 --> 03:04.580 you've typed everything exactly as I have which is lower case data 45 03:04.610 --> 03:10.470 and then inside data there's something called db. And we're going to leave all of that empty but just check 46 03:10.470 --> 03:16.200 up here to see that you've got exactly the same kind of file path and directories as I have. 47 03:16.200 --> 03:19.710 So inside your C drive you got a folder called data inside data 48 03:19.710 --> 03:21.800 you've got something called db. 49 03:21.990 --> 03:28.380 Now that we've successfully installed MongoDB we have to get it set up so that we can use it easily 50 03:28.380 --> 03:30.120 through the hyper terminal. 51 03:30.120 --> 03:32.720 And in order to do that we first have to check something. 52 03:32.730 --> 03:40.140 So if you head into Explorer and just go into your C-drive and then scroll down until you see Program 53 03:40.140 --> 03:46.510 Files, double click on that and we're going to scroll down until we find MongoDB. 54 03:46.650 --> 03:47.250 Here it is. 55 03:47.250 --> 03:51.520 And then we're going to go inside that folder and then inside the folder called server. 56 03:51.810 --> 03:58.290 So now you should see a folder with a version number and this corresponds to the rough version of your 57 03:58.290 --> 03:59.150 MongoDB 58 03:59.160 --> 04:02.040 and this says 4.0. 59 04:02.040 --> 04:11.430 And we want to set up a shortcut so that we can launch our mongo.exe and mongod.exe straight from 60 04:11.520 --> 04:15.050 our hyper terminal using bash. 61 04:15.210 --> 04:22.680 And now I want you to open up your hyper terminal and just change directory to your home folder by typing 62 04:22.680 --> 04:25.200 in cd and then adding the tilde sign. 63 04:25.290 --> 04:33.220 And once you've navigated there, I want you to go ahead and create a new file called .dash_ 64 04:33.360 --> 04:36.690 profile and it has to be spelt exactly this way. 65 04:36.720 --> 04:38.770 And then hit enter to create it. 66 04:38.850 --> 04:45.870 And now that should be created if we do an ls -a we should be able to see it in a list of files 67 04:45.870 --> 04:50.040 here and there it is .bash_profile. 68 04:50.040 --> 04:55.530 So this is a hidden file that we've created which is going to tell our hyperterminal that when it starts 69 04:55.530 --> 05:01.300 up and we want to access mongo and mongod we have a shortcut for it. 70 05:01.320 --> 05:05.880 So now that we've created that file now we're going to edit it using vim. 71 05:05.890 --> 05:12.180 So to do that we're going to type vim and then we're going to specify the file that we want to edit which 72 05:12.180 --> 05:14.770 was .bash_profile. 73 05:14.970 --> 05:21.930 So now if you hit enter this will now open up that file using the vim text editor which is a command 74 05:21.930 --> 05:23.330 line based text editor. 75 05:23.490 --> 05:28.650 Now there's a lot of memes around the vim editor and it's because it's not a graphical user interface 76 05:28.920 --> 05:34.250 so there aren't any buttons to click on and it's a little bit more complex to get to grips with. 77 05:34.380 --> 05:38.340 But I'm going to quickly show you how you can use it in a very simple way. 78 05:38.550 --> 05:44.310 So firstly in order to stand actually be able to type anything in the vim editor we're going to hit 79 05:44.310 --> 05:51.660 the i key, so 'i' for indigo on your keyboard and that will initiate the insert mode. And now you can actually 80 05:51.660 --> 05:57.840 start typing stuff into this editor. And you can either type this out although it's kind of error prone. 81 05:57.840 --> 06:05.430 So I would recommend that you head over to the written installations for MongoDB for Windows and there's 82 06:05.430 --> 06:06.330 a link to this 83 06:06.330 --> 06:08.960 in the course resources for this module. 84 06:09.150 --> 06:16.260 And I just want you to scroll down to this part where you see there's this alias mongodb alias mongo 85 06:16.650 --> 06:19.340 and a file path that we've specified. 86 06:19.500 --> 06:28.440 I just want you to go ahead and copy both of those two lines and then paste it into vim. So you can 87 06:28.440 --> 06:34.170 either use the shortcut or you can simply just navigate to it from this little menu icon at the top. 88 06:34.170 --> 06:41.760 Now the thing you have to change here is we saw earlier on what was the version that you saw and C - program 89 06:41.760 --> 06:43.330 files - MongoDB - server. 90 06:43.380 --> 06:45.170 And for me it's 4.0. 91 06:45.180 --> 06:52.290 Now if you're installing this at some point in the future that might read 4.1 or 5.0 I just want you 92 06:52.290 --> 06:59.070 to change this part of the code to whatever it is you see there so that they match because this has 93 06:59.070 --> 07:04.830 to be an entire file path that leads to mongo.exe and mongod.exe. 94 07:04.950 --> 07:12.360 So if you go ahead again look inside your Explorer and you navigate from local disk C to program 95 07:12.360 --> 07:22.030 files to MongoDB to server to 4.0 to bin, then you can see here is where our mongo.exe 96 07:22.050 --> 07:24.650 and mongod.exe reside. 97 07:24.660 --> 07:30.990 So this file path is going to lead to those files and we're creating simply an alias that makes it easier 98 07:30.990 --> 07:34.880 for us to work with it inside our hyper terminal. 99 07:34.890 --> 07:40.980 So if you need to edit this then just go ahead and change these parts to whatever it is that you see 100 07:41.430 --> 07:42.860 in your version. 101 07:42.960 --> 07:48.870 And then we're going to go ahead and save and exit vim which can be a little bit tricky but it's not 102 07:48.870 --> 07:57.150 too hard. You just have to hit ESC to exit insert mode and we're going to type :wq and then 103 07:57.240 --> 07:59.020 the !. 104 07:59.040 --> 08:05.880 And now if you hit enter you would have saved that file and you would have exited vim. 105 08:05.900 --> 08:11.080 So now we're ready to test and see whether if our installation has succeeded. 106 08:11.210 --> 08:19.680 I want you to go ahead and close down your hyper terminal and you're going to simply relaunch it. 107 08:19.790 --> 08:26.530 So now that we've restarted our hyper terminal then it's time to test and see if our installation has 108 08:26.530 --> 08:33.670 succeeded. And we'll do that by writing mongo --version and hit enter. 109 08:33.920 --> 08:40.550 Now if you see something that looks like this where it says MongoDB shell version 4.0.3 or a new version 110 08:40.760 --> 08:46.220 but something that looks like this, then congratulations you have completed all of the setup and installation 111 08:46.280 --> 08:50.550 of MongoDB and you're ready to proceed to the next lesson. 112 08:50.570 --> 08:57.230 Now if you see something else such as bash mongo not found or something like that where it doesn't look 113 08:57.230 --> 09:03.080 like this, then be sure to retrace your steps and maybe follow all of the instructions in the written 114 09:03.080 --> 09:07.340 tutorials and just make sure that you haven't made any typos and anything that you're typing in looks 115 09:07.370 --> 09:12.850 exactly the same or simply just copy and paste it from the instructions. 116 09:12.920 --> 09:17.900 But now that we've completed installation and setup then you're ready to get started learning about 117 09:17.960 --> 09:18.800 MongoDB.