Today I will explain how to install MongoDB in Windows. You can read my previous MongoDB introduction article from here:
C:\Program Files\MondoDB\Server\3.0\bin.
Step 9
Now go to
System Properties and press the
Environment Variables button.
Step 10
Select the
Path variable from the
System variables.
Now paste this path here.
Step 11
Then we create a default directory where MongoDB will save all its data. For this open a command prompt and execute the following command.
Now you will find that the folder named
data has been created in your C: directory, this folder contains another folder whose name is
db. So far the db folder is empty. In the future all the data and the database will be stored here.
After all the preceding tasks we run the MongoDB server and client. First close the opened Command Prompt and open it again.
First run the “
mongod” command . When you run this command the system will show many messages.
The
MongoDB command is used to run a server at a specific port number. By default this port number is 27017.
Now again go to the
C:\data\db directory. You will find that some files and folders have been created automatically. All these files are generated by Mongod. Each file and folder has a specific task and use.
Open another command prompt window and run the mongo command.
The
Mongo command is use to start a client. If you watch the previous command prompt (in which we ran the MongoDB command) you will find the following message:
This message shows that the number of active clients is one. If you open another command prompt and run the mongo command then you will find that the number of opened connection is two.
The installation and configuration has been completed.
Today we learned how to install MondoDB in Windows. The next articles will start working on MongoDB. Until then keep coding.