One: Selection, according to the machine's operating system type to select the appropriate version, use the following command line to query the machine's operating system version
WMIC OS get Osarchitecture
Two: Download and install
Attached download link
Click Install package, I am here to install the file (E:\MongoDB)
After the installation, the following file appears under this folder,
This time, create a new data folder to hold all of MongoDB, create a new log folder to hold the log file
Three: Start the MongoDB database, execute the following command in the Command Line window, and you will see the following message after the execution is completed.
E:\mongodb\bin\mongod.exe--dbpath E:\mongodb\data
You can find that the process number is 14288 and the listening port is 27017 by prompting the message.
Enter http://localhost:27017/in the browser
You is trying to access MongoDB on the native driver port. For HTTP diagnostic access, add the port number
Thus, the MongoDB database service has successfully started
Four: Connect and test Insert data
Double-click to open the Mongo.exe client program in the installation directory bin directory and connect to the test database by default after opening.
CRUD Operations Testing
More and more full crud operations
The long-winded focus finally came ...
Create a Windows service for MongoDB
- Configuration log file path
- Configure the database path
- Installing the Window Service
Installation results:
- Start mongodb Service (net start mongodb)
- Stop the mongodb Service (net stop MongoDB)
- Delete MongoDB service (SC. EXE delete MongoDB)
Here are the commands that are used by the installation service:
echo logpath=e:\mongodb\log\mongod.log> E:\MongoDB\mongod.cfgecho dbpath=e:\mongodb\data>> E:\MongoDB\ Mongod.cfge:\mongodb\bin\mongod.exe--config E:\MongoDB\mongod.cfg--install
Create a Windows service for MongoDB