In this blog article, we will learn how to setup MongoDB on windows machine without installing it.
For that we will need to download the latest zip format of the community edition. You can visit MongoDB site (https://www.mongodb.com/). Go to Software menu option and select Community server. Or you can use this link: https://www.mongodb.com/try/download/community
In the available downloads section, select zip option in the package drop-down, And download it.
After that extract it in any location on your disk.
By default, MongoDB uses the C:/data/db folder. So, you will need to create this folder path.
Now go inside the extracted location of MongoDB zip file, and open a command line/terminal window there. Run this command:
Mongod.exe is the primary daemon process for the MongoDB system. It makes the MongoDB running as service, although its not running as windows service. But if you would have installed the MongoDB on your system, then it would be running as windows service.
Now you can create databases and interact with MongoDB. You can even download the zip version of MongoDB Compass, which is a GUI tool to work with MongoDB. Although you can also try the CLI to check your databases. And for that you don’t need any extra download, its available in the MongoDB zip archive. So again, in the extracted location of MongoDB zip file, open another window there and run this command:
It will give you interactive shell for executing the MongoDB command. You can try below command:
It will show you the list of available databases.
I find this way useful, as I don’t want it installed on my system, as I use it for very few projects. Only downside of this approach it that you need to keep mongod.exe terminal window open and running all the time when you use MongoDB on your system.