Download MongoDB
: https://www.mongodb.com/download-center?jmp=nav#community
Here is the installation of MongoDB under the Windows platform,
After downloading, on this computer, follow the prompts to install.
Note: This installation is only to get MongoDB files, the installed machine is not a server.
For example, this machine is installed in D:\MongoDB\Server\3.2
Configure server 1. Create a Directory
Create directory C:\MongoDB on the server (Windows Server 2008), such as:
Consists of four directories
BIN |
MongoDB Program Files |
Config |
Configuration file |
Data |
Data Files Directory |
Log |
Log file |
2. Copying files
Copy all the files in the D:\MongoDB\Server\3.2\BIN directory that you have installed in the first step to the server C:\MongoDB\BIN directory.
In addition, the Msvcp120.dll and Msvcr120.dll files are found in this machine, and also copied to the bin directory of the server.
3. Configuration files
In the config directory, create the Mongod.cfg file. The contents are as follows:
Dbpath=c:\mongodb\data
Logpath=c:\mongodb\log\mongo.log
Logappend=true
Directoryperdb=true
#auth =true
Start MongoDB Service
In the server's C:\MongoDB\Bin directory, run cmd as Administrator, and execute the following command
SC create MongoDB binpath= "C:\MongoDB\bin\mongod.exe--config=c:\mongodb\config\mongod.cfg--service"
Then start the service net start MongoDB
Test
In the C:\MongoDB\Bin directory, run cmd, and execute the following command
C:\mongodb\bin>mongo
Show DBS//Display Database
Use MyDB//create and switch databases
Db. Projects.insert ({"Name": "Project"})//In the Projects collection, insert a record
Help//Assistance
Connection test
On the client, run Mongovue and connect to the server.
Test Connection succeeded!
Uninstalling the MongoDB service
On the server side, run cmd as Administrator and execute the following command:
C:\MongoDB\bin mongod.exe--remove--servicename "MongoDB"
MongoDB Learning Note One: Configuring