Hey whats up guys welcome back to the series and today we'll be seeing how to install and
setup mongoDB locally on your system so first you have to download the mongoDB file so head
over to your browser and search for the website mongoDB.com here click on this download button
now we want to download the community server so click on the community server tab as you
can see we have mongo DB for all the three OS so we're downloading for the windows so
click on this download button the file is going to be a little bit big maybe about 100
+ megabyte so if you are following along with me then pause the video now and Resume back
once it's downloaded I've already downloaded the file so just double tap on it and start
with installation process so click on next here agree the terms and condition now there
are two options 1 is to do with a complete form and other is a custom one so if you just
click on the complete it is just going to start the installation process but I'll show
you if you want to do a custom installation you can you can do that as well so click on
the custom button here so you are now you can actually change the path where mongoDB
is going to get installed so I am going to actually change the path click on this browse
button here I am just going to save it on my C drive and create a folder called mongoDB
and I'll just save it there but then again you can definitely choose any other part which
way you like or you can just stick to the custom one so after that click on next here
now you can see an option if you want to install mongo DB compass as well now if you would
have clicked on the complete setup previously then it would have install the mongo DB compass
but if you don't want it you can uncheck it here which in our case I am going to uncheck
it because it takes a little more time to install so uncheck it if you don't want it
but if you want the mongo DB compass you can definitely keep it the way it is right now
and click on next so after this the installation will start it might take some time depending
upon your system so just wait till the installation completes so now the installation is finished
so now let's first head over to the folder where we have install the mongo DB so its
C drive mongo DB folder now you will see bunch of files in a folder but we need to create
some more folders so first folder will be data and I will create one more folder called
log and then within the data folder will create one more folder called db so why are you doing
this I'll just tell you in a minute so now just open Command Prompt and remember to open
it with administrator rights so now head over to the folders in our case it CD mongo DB
and CD binn so we are inside the Bin folder now we have to add a couple of flags before
we start the mongo DB as a service the very first flag is Mongod --directoryperdb so this
flag tells us that each database will be stored in a separate directory and next flag is --dbpath
and here we are going to mention the path which in our case is C drive mongo DB and
remember we created folder called data and within this we have a folder(*Mistake in audio*)
of db so we want to store databases within this so we are going to mention this path
now next flag is for --logpath so why do we need logpath if you want to inspect our errors
we need a log file for it so we have to mention a log path and we have created a log folder
as well so we'll just give a path of that folder and within that we need a log file
so I'll just name that file as mongo.log what this is going to do is it will overwrite all
the logs which are previously present with the new log which we will get at every instant
so we don't want that we want to append the logs so we have to just add one more flag
which will be --logappend so I think this is it just now we have to install so we'll
do --install and then hit enter so you might get a message or you'll just get something
like this only and about this flags there are many of them so you can just check if
you want by typing mongod --help and you will see a bunch of flags there but these are the
flags which I personally prefer so I just showed you but if you don't want to add them
for you and you add something else you can just check out this list so after this we
can start the mongo DB so we'll do net start mongoDB now this mongo DB text is not case
sensitive so you can either keep everything is small or in capitals it doesn't matter
so just after this hit enter and you will start seeing a message that MongoDB service
is starting and yeah mongo DB service was started successfully so now we have successfully
started our mongo DB server so that's it for today I think yeah so in the next video we
are going to see how to create users and manage users so I'll see you the next video also
if you haven't subscribed to my channel subscribe right now to get notifications of the upcoming
videos as well
Không có nhận xét nào:
Đăng nhận xét