The document is based on:
MongoDB for Windows Server 2008 R2 edition (i.e. 2008R2) runs only on Windows Server 2008 R2, Windows 7 64-bit, and newer versions of Windows. This build takes advantage of recent enhancements to the Windows Platform and cannot operate on older versions of Windows.
MongoDB for Windows 64-bit runs on any 64-bit version of Windows newer than Windows XP, including Windows Server 2008 R2 and Windows 7 64-bit.
MongoDB for Windows 32-bit runs on any 32-bit version of Windows newer than Windows XP. 32-bit versions of MongoDB are only intended for older systems and for use in testing and development systems. 32-bit versions of MongoDB only support databases smaller than 2GB.
You can download the installment file (msi) or zip file. If you download zip file, you will just need to extract the compressed file without necessary installment. Then you start the configuration.
Note: MongoDB has 2 versions named as Community Server and Enterprice Server. Of which, the Community is the free version, and Enterprice is commercial one. In this post, I will guide you to set up and configure the free version.
Choose to install Mongodb Compass, this is a visual tool that helps you work with MongoDB.
OK, bạn vừa cài đặt xong MongoDB và Mongo Compass.
This is folder you have installed (or unzip)
We create a folder containing the data of Database, a folder containing log file, and a configuration file, etc. For the best, put it in a safe drive instead of the C drive.
Create a folder:
Next, create 2 subfolders
And create a configuration file:
##all output go here
Now the configuration of MongoDB is successful. Next, we run MongoDB.
Here we run by CMD, but you can create a Service of window so that it can auto-start whenever window runs (See Appendix)
Open cmd and cd to the bin folder of mongodb.
Command to start MongoDB:
mongod.exe --config D:\MongoStore\config.txt
If you receive the error below, see the fix at the end of this post.
Keep the CMD do not turn off.
After running MongoDB as the above step (Or let it auto-run as a service of Window), you open another CMD window for connecting with Database. In fact, you need a visual tool, but let try starting with MongoDB through CMD.
OK now you have to connect to the database test.
Execute commands on the CMD working with MongoDB:
8- Visualization tools to work with MongoDB
You need to install a visual tool for working with MongoDB database:
9- Appendix: Configuring MongoDB as a windows service
Open CMD and cd to bin folder of Mongodb. You need to open CMD under the authority of ADMIN.
Next run the command:
mongod.exe --config D:\MongoStore\config.txt --install
Next, you open mongo.log file:
Now on Window Service has service MongoDB.
You can start service on service explorer or start by CMD:
To fix this, you need to install the "Visual C ++ Redistributable", which you can download at the address below: