0 1 00:00:00,150 --> 00:00:07,290 First things first. Head over to mongodb.com and we're going to click on get MongoDB to download 1 2 00:00:07,290 --> 00:00:07,910 it. 2 3 00:00:08,010 --> 00:00:13,740 Now you should be taken to the MongoDB download center and the first tab that's usually selected by 3 4 00:00:13,740 --> 00:00:16,290 default is their cloud service 4 5 00:00:16,320 --> 00:00:22,590 so the MongoDB Atlas service which we're going to explore a little bit later on when we actually deploy 5 6 00:00:22,590 --> 00:00:23,410 our database. 6 7 00:00:23,580 --> 00:00:26,010 But for now we want to choose the service tab. 7 8 00:00:26,340 --> 00:00:30,430 And down here you should have your Windows version already pre-selected 8 9 00:00:30,660 --> 00:00:35,630 and we're going to select the current version of MongoDB. 9 10 00:00:35,790 --> 00:00:40,160 Now it's really important that you change this package from zip to MSI 10 11 00:00:40,440 --> 00:00:45,750 because this is going to download a installation wizard and it'll make everything a lot easier for us 11 12 00:00:45,990 --> 00:00:47,010 going forward. 12 13 00:00:47,010 --> 00:00:55,210 So once you're done here then just go ahead and click download and now download should begin. 13 14 00:00:55,210 --> 00:01:01,180 Now once download is completed you should be able to head into your Downloads folder and see this installation 14 15 00:01:01,180 --> 00:01:01,910 wizard. 15 16 00:01:01,930 --> 00:01:04,060 It's going to be called something like mongodb 16 17 00:01:04,060 --> 00:01:05,580 something something something 17 18 00:01:05,650 --> 00:01:07,130 .msi. 18 19 00:01:07,300 --> 00:01:09,920 And this is going to be your installer. 19 20 00:01:10,060 --> 00: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 21 00:01:16,240 --> 00:01:17,400 click next. 21 22 00:01:17,530 --> 00: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 23 00:01:23,890 --> 00:01:31,480 and then you're going to select Run service as a network service user and make note of this directory 23 24 00:01:31,480 --> 00:01:33,850 path that they've created here for you. 24 25 00:01:33,850 --> 00:01:40,250 This is where they're going to install MongoDB. It's going to be on the C:\Program Files/MongoDB/ 25 26 00:01:40,250 --> 00:01:43,320 server\4.0. 26 27 00:01:43,600 --> 00:01:49,460 And I recommend keeping to this exact same file path because we'll need a little bit later on. 27 28 00:01:49,630 --> 00: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 29 00:01:54,460 --> 00:01:59,800 So then you're going to select next and we're going to uncheck install MongoDB compass because 29 30 00:01:59,800 --> 00:02:01,210 we don't actually need it. 30 31 00:02:01,450 --> 00:02:06,640 And then click next and finally click install to start the installation. 31 32 00:02:07,870 --> 00:02:15,030 And once installation has complete simply click Finish and you'll exit out of the installation wizard. 32 33 00:02:15,240 --> 00:02:15,510 All right. 33 34 00:02:15,510 --> 00:02:22,080 So now that we've successfully installed MongoDB using the installer, if you now go into your C-drive 34 35 00:02:22,170 --> 00: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 36 00:02:29,040 --> 00:02:29,980 called server 36 37 00:02:30,030 --> 00:02:33,330 and then there's the version of the MongoDB that you installed. 37 38 00:02:33,330 --> 00:02:36,350 and then finally we get access to our binaries. 38 39 00:02:36,630 --> 00: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 40 00:02:42,330 --> 00:02:44,950 databases on our local system. 40 41 00:02:45,000 --> 00:02:48,020 So I want you to go ahead into your C drive, 41 42 00:02:48,180 --> 00: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 43 00:02:53,580 --> 00:02:55,260 to be called data. 43 44 00:02:55,410 --> 00: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 45 00:03:00,810 --> 00:03:04,580 you've typed everything exactly as I have which is lower case data 45 46 00:03:04,610 --> 00: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 47 00:03:10,470 --> 00:03:16,200 up here to see that you've got exactly the same kind of file path and directories as I have. 47 48 00:03:16,200 --> 00:03:19,710 So inside your C drive you got a folder called data inside data 48 49 00:03:19,710 --> 00:03:21,800 you've got something called db. 49 50 00:03:21,990 --> 00: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 51 00:03:28,380 --> 00:03:30,120 through the hyper terminal. 51 52 00:03:30,120 --> 00:03:32,720 And in order to do that we first have to check something. 52 53 00:03:32,730 --> 00: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 54 00:03:40,140 --> 00:03:46,510 Files, double click on that and we're going to scroll down until we find MongoDB. 54 55 00:03:46,650 --> 00:03:47,250 Here it is. 55 56 00:03:47,250 --> 00:03:51,520 And then we're going to go inside that folder and then inside the folder called server. 56 57 00:03:51,810 --> 00:03:58,290 So now you should see a folder with a version number and this corresponds to the rough version of your 57 58 00:03:58,290 --> 00:03:59,150 MongoDB 58 59 00:03:59,160 --> 00:04:02,040 and this says 4.0. 59 60 00:04:02,040 --> 00: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 61 00:04:11,520 --> 00:04:15,050 our hyper terminal using bash. 61 62 00:04:15,210 --> 00: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 63 00:04:22,680 --> 00:04:25,200 in cd and then adding the tilde sign. 63 64 00:04:25,290 --> 00:04:33,220 And once you've navigated there, I want you to go ahead and create a new file called .dash_ 64 65 00:04:33,360 --> 00:04:36,690 profile and it has to be spelt exactly this way. 65 66 00:04:36,720 --> 00:04:38,770 And then hit enter to create it. 66 67 00:04:38,850 --> 00: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 68 00:04:45,870 --> 00:04:50,040 here and there it is .bash_profile. 68 69 00:04:50,040 --> 00: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 70 00:04:55,530 --> 00:05:01,300 up and we want to access mongo and mongod we have a shortcut for it. 70 71 00:05:01,320 --> 00:05:05,880 So now that we've created that file now we're going to edit it using vim. 71 72 00:05:05,890 --> 00: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 73 00:05:12,180 --> 00:05:14,770 was .bash_profile. 73 74 00:05:14,970 --> 00: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 75 00:05:21,930 --> 00:05:23,330 line based text editor. 75 76 00:05:23,490 --> 00: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 77 00:05:28,920 --> 00: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 78 00:05:34,380 --> 00:05:38,340 But I'm going to quickly show you how you can use it in a very simple way. 78 79 00:05:38,550 --> 00: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 80 00:05:44,310 --> 00: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 81 00:05:51,660 --> 00:05:57,840 start typing stuff into this editor. And you can either type this out although it's kind of error prone. 81 82 00:05:57,840 --> 00:06:05,430 So I would recommend that you head over to the written installations for MongoDB for Windows and there's 82 83 00:06:05,430 --> 00:06:06,330 a link to this 83 84 00:06:06,330 --> 00:06:08,960 in the course resources for this module. 84 85 00:06:09,150 --> 00: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 86 00:06:16,650 --> 00:06:19,340 and a file path that we've specified. 86 87 00:06:19,500 --> 00: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 88 00:06:28,440 --> 00:06:34,170 either use the shortcut or you can simply just navigate to it from this little menu icon at the top. 88 89 00:06:34,170 --> 00: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 90 00:06:41,760 --> 00:06:43,330 files - MongoDB - server. 90 91 00:06:43,380 --> 00:06:45,170 And for me it's 4.0. 91 92 00:06:45,180 --> 00: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 93 00:06:52,290 --> 00: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 94 00:06:59,070 --> 00:07:04,830 to be an entire file path that leads to mongo.exe and mongod.exe. 94 95 00:07:04,950 --> 00:07:12,360 So if you go ahead again look inside your Explorer and you navigate from local disk C to program 95 96 00:07:12,360 --> 00:07:22,030 files to MongoDB to server to 4.0 to bin, then you can see here is where our mongo.exe 96 97 00:07:22,050 --> 00:07:24,650 and mongod.exe reside. 97 98 00:07:24,660 --> 00: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 99 00:07:30,990 --> 00:07:34,880 for us to work with it inside our hyper terminal. 99 100 00:07:34,890 --> 00: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 101 00:07:41,430 --> 00:07:42,860 in your version. 101 102 00:07:42,960 --> 00: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 103 00:07:48,870 --> 00: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 104 00:07:57,240 --> 00:07:59,020 the !. 104 105 00:07:59,040 --> 00:08:05,880 And now if you hit enter you would have saved that file and you would have exited vim. 105 106 00:08:05,900 --> 00:08:11,080 So now we're ready to test and see whether if our installation has succeeded. 106 107 00:08:11,210 --> 00:08:19,680 I want you to go ahead and close down your hyper terminal and you're going to simply relaunch it. 107 108 00:08:19,790 --> 00: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 109 00:08:26,530 --> 00:08:33,670 succeeded. And we'll do that by writing mongo --version and hit enter. 109 110 00:08:33,920 --> 00: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 111 00:08:40,760 --> 00:08:46,220 but something that looks like this, then congratulations you have completed all of the setup and installation 111 112 00:08:46,280 --> 00:08:50,550 of MongoDB and you're ready to proceed to the next lesson. 112 113 00:08:50,570 --> 00: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 114 00:08:57,230 --> 00:09:03,080 like this, then be sure to retrace your steps and maybe follow all of the instructions in the written 114 115 00:09:03,080 --> 00:09:07,340 tutorials and just make sure that you haven't made any typos and anything that you're typing in looks 115 116 00:09:07,370 --> 00:09:12,850 exactly the same or simply just copy and paste it from the instructions. 116 117 00:09:12,920 --> 00:09:17,900 But now that we've completed installation and setup then you're ready to get started learning about 117 118 00:09:17,960 --> 00:09:18,800 MongoDB.