1 00:00:02,340 --> 00:00:07,020 Now that we talked about the different options you can set and you can use to run your mongodb 2 00:00:07,020 --> 00:00:07,860 server, 3 00:00:08,040 --> 00:00:12,450 it's also worth mentioning that you can save your settings in a configuration file. 4 00:00:12,450 --> 00:00:14,610 If you google for mongodb config file, 5 00:00:14,790 --> 00:00:19,910 you should find this article from the official docs and there, you can learn that you can create a 6 00:00:19,950 --> 00:00:24,370 mongodb config file and you might also get one by default 7 00:00:24,390 --> 00:00:29,340 after your installation but I for example did not get one on Mac. So you might get one 8 00:00:29,340 --> 00:00:35,100 otherwise you can simply create one and you can create it anywhere you want and I will do that too. 9 00:00:35,340 --> 00:00:42,000 I will create a config file here in my bin folder let's say, I actually did already create one 10 00:00:42,010 --> 00:00:43,920 I name it mongodb.cfg, 11 00:00:43,940 --> 00:00:49,730 so you can simply create this with a text editor. And here I'll edit it with Visual Studio code because that 12 00:00:49,730 --> 00:00:54,630 is a nice editor for this and makes well reading that file really easy. 13 00:00:54,680 --> 00:01:00,170 Now you see I already have a file where I added some settings and this is how you do add settings and 14 00:01:00,170 --> 00:01:03,960 you find detailed instructions in an article I just pointed you at, 15 00:01:04,020 --> 00:01:06,860 there you also find one example of config file 16 00:01:06,980 --> 00:01:12,830 and if you google for mongodb example of config file, you also find more examples by other users. 17 00:01:12,830 --> 00:01:15,590 Now this is a more comprehensive file, 18 00:01:15,590 --> 00:01:17,330 I've got a very simple file here, 19 00:01:17,360 --> 00:01:23,060 in the end I here only set the path to my database, so where all the database files should be stored 20 00:01:23,510 --> 00:01:25,070 and to my log files 21 00:01:25,070 --> 00:01:32,570 and I also explicitly need to tell mongodb that this path points at a log file and that is my 22 00:01:32,570 --> 00:01:33,950 mongodb config file. 23 00:01:33,950 --> 00:01:35,290 Now the question just is 24 00:01:35,360 --> 00:01:39,620 how do I use that file when starting a new mongodb instance? 25 00:01:39,620 --> 00:01:44,900 And it's not the case that mongod would pick up this file automatically because how would it know that 26 00:01:44,900 --> 00:01:50,450 it should, that this file exists and where it could find this file. Instead 27 00:01:50,640 --> 00:01:59,730 when starting mongodb, you can use the --config option or a shortcut for that, -f and then 28 00:01:59,730 --> 00:02:02,280 pass a path to the config file, 29 00:02:02,280 --> 00:02:11,850 so in my case that's in my mongodb folder /bin/mongod.cfg and you could also name this conf, 30 00:02:11,950 --> 00:02:13,420 that doesn't really matter. 31 00:02:14,180 --> 00:02:18,320 With that, you could hit enter and it should now still start 32 00:02:18,320 --> 00:02:22,990 your mongodb server with the setting set up in the configuration file 33 00:02:23,180 --> 00:02:28,340 and this is of course a very useful feature too because this allows you to basically save a snapshot 34 00:02:28,370 --> 00:02:29,300 of your settings, 35 00:02:29,320 --> 00:02:36,500 a reuseable blueprint all of your settings in a separate file which you can then always well use for 36 00:02:36,500 --> 00:02:42,260 starting up your server and you can find all the information about all the possible options and what 37 00:02:42,260 --> 00:02:42,890 they do 38 00:02:43,010 --> 00:02:44,770 in this article I pointed you at. 39 00:02:44,810 --> 00:02:51,350 So if you want to dive deeper into this, definitely check out this article. With that and with the settings 40 00:02:51,350 --> 00:02:52,820 you saw in the other lectures, 41 00:02:52,970 --> 00:02:55,940 you should have a solid toolset of working with the 42 00:02:55,940 --> 00:02:59,810 mongodb server and starting it in the way you want it to start.