MongoDB is an open-source NoSQL database that is used primarily for data-heavy occasions and as a golden partner of node. JS, because it uses binary JSON format, so it has an affinity with JavaScript that no language can match. The specific introduction of this article does not elaborate, the following mainly for MongoDB under Windows to join the local services to do some simple sharing. To facilitate the first contact with MongoDB and in the Windows environment for the development of students.
First go to the official website to download the Windows installation package: Http://www.mongodb.org/downloads
In general, choose the default 64-bit (unless your host is 32-bit), after downloading, suppose we install to: D:\mongodb-win32-i386-2.4.5, after completion,
I like to re-build a folder D:\mongodb Enter the directory, create a new data and logs two folders, and create a new mongodb.log in the logs directory.
Work is ready, now it's time to start MongoDB service.
We need to create a permanent service, which requires us to add MONGO to the Windows Local Service,
Here I wrote a script to initialize the database:
1 @echo off2 CLS3 4 Color 8A5 6 Echo.7 Echo.8 echo "01.install Windows Service"9 mongod--dbpath "D:\mongodb\data"--directoryperdb--logpath "D:\mongodb\logs\mongodb.log"--logappend--install- ServiceName "MongoDB"Ten One Echo. A Echo. - echo "02.start service" - net start MongoDB the - Echo. - Echo. - echo "03.init success" +Pause
Of course, there are scripts to unload the database:
@echo offcolor 8aecho.echo.echo "01.stop service" net stop MongoDBecho.echo.echo "02.remove Windows Service" Mongod-- DBPath "D:\mongodb\data"--logpath "D:\mongodb\logs\mongodb.log"--remove-servicename "MongoDB" Echo.echo.echo "03. Stop Success "Pause
Run the Build database initialization. Bat after display:
Indicates that the MONGODB service has been installed on Windows;
Open the Services window to see:
The first experience of MongoDB