In this post we will learn how we can quickly install and get started with MongoDB on Windows platform. We will also setup to run MongoDB commands from anywhere.
Downloading MongoDB on Windows
Download a community version of MongoDB from the official download site:
https://www.mongodb.com/download-center/community
Once you download the MSI executable package, you should be run the installer and install MongoDB. The installer will also ask you to optionally install MongoDB Compass. This is a GUI tool for visually exploring your data in MongoDB.
Since it will be a useful tool later, go ahead and install MongoDB as well.
Setup MongoDB Command As Path Variable
Once installed, we want to run MongoDb commands from anywhere on the computer. This will be really efficient once you setup MongoDB commands via PATH variable.
So, go ahead and add MongoDB to the environment variable by adding the path to the bin folder:
C:\Program Files\MongoDB\Server\[YOUR_VERSION]\bin\
Once added in the PATH, open the command prompt terminal and type:
mongo
If everything went well, you would be connected to the MongoDB server on default port i.e. 27017.
Congratulations, now you are ready to start working with MongDB on your Windows!