In the previous lessons, we have learnt about Introduction, Overview, Advantages, Features and when to use MongoDB. With this lesson, we will see the steps to install the MongoDB on a Windows machine. In fact MongoDB installation is very easy. Below are the steps involved in installing the MongoDB.
.msifile from the site MongoDB Download Centre. Select the latest version for Windows, the Windows Server 2008 R2 is the version if you are on Windows 7, 8 or 10.
.msifile to start the installation. Select the option Custom during the installation process, to specify a custom location where you want MongoDB to be installed. By default it is installed in
data\db. It is best practice to create this directory under the folder where the MongoDB is installed. So let's create a folder named data and one more folder named db inside data folder as shown below.
mongod.exe --dbpath "DATA_DIRECTORY_PATH"to configure the data path and start the MongoDB server. Please replace the DATA_DIRECTORY_PATH with the path of data directory present inside MongoDB installed folder. On running this command, the below log will be displayed which says that the MongoDB configuration is successful and the server is up and running fine.
mongoin Command Prompt and it will get connected to the MongoDB where the default database is test.