MongoDB 's official website is:http://www.mongodb.org/
The latest version of MongoDB is downloaded under the DownLoad menu on the official website :http://www.mongodb.org/downloads
I chose the Windows 32-bit 1.8.1 version
MongoDB for. NET Driver Development Kit is located on the official website of the Driver menu (including other language development links):https://github.com/mongodb/ Mongo-csharp-driver/downloads
My operating system is Windows7 Professional Edition, choose MongoDB version for Windows 32-bit 1.8.1, development package for VS2008 version
Let's start our installation process.
Second, installation
1. unzip C:\PROGRAM FILES\MONGODB  bin file COPY TO  this folder
2.c:\program Files\mongodb set up the Data folder C:\Program files\mongodb\data, and then separate the db,log two folders, This is the following folder under MongoDB
C:\Program Files\mongodb\bin
C:\Program files\mongodb\data\db
C:\Program Files\mongodb\data\log
Create a log file under the log folder MongoDB.log, which is C:\Program files\mongodb\data\log\ MongoDB.log
After completing the above work, you are wondering why to create these folders (because theMongodb installation requires these folders, the default installation is not created, but the files are installed to C:\data\ )
3. introduction of several installation methods
3.1 program start mode
Run cmd.exe into DOS hit interface
> CD C:\Program files\mongodb\bin
> C:\Program files\mongodb\bin>mongod-dbpath "C:\Program files\mongodb\data\db"
Execute this command to create a mongodb database file into the C:\Program files\mongodb\data\db directory, and not unexpectedly see the last line of the command sucess Tips for Success
At this point the database has been started, the interface is Mongo startup program, closed after you can directly double-click on the bin mongod.exe ( Note is D, this is the starter program)
After the startup program is turned on, run the mongo.exe Program (note that there is no D) , the interface is as follows
Test database Operations
>help ( View related information)
>db.foo.insert ({a:1}) ( insert a,1 field value to foo table, foo table as default table )
>db.foo.find () ( view foo table data)
The results are as follows:
You can see that 3 Records were inserted a,cctv,set .
When Mongod.exe is turned off,mongo.exe cannot connect to the database, so each time you want to use a mongodb database, you must open mongod.exe program, so the trouble is, next we will
MongoDB installed as a Windows service bar
3.2 Windows Service mode
Run cmd.exe
> CD C:\Program files\mongodb\bin
> C:\Program files\mongodb\bin>mongod--dbpath "C:\Program files\mongodb\data\db"--logpath "C:\Program files\ Mongodb\data\log\mongodb.log "--install--servicename" MongoDB "
Here MongoDB.log is the log file that was started,--servicename the "MongoDB" service named MongoDB
Run the command successfully for such as:
The time service has been installed successfully, running
>net start MongoDB ( Open service)
>net Stop MongoDB ( shutdown service )
>
> C:\Program files\mongodb\bin>mongod--dbpath "C:\Program files\mongodb\data\db"--logpath "C:\Program files\ Mongodb\data\log\mongodb.log "--remove--servicename" MongoDB "( Delete, note not --install )
Other commands can be found on the help command or official website.
View Services
Run the bin folder under the mongo.exe client to test it. The test is the same as 3.1.
3.3 daemon Process mode
--fork running MongoDB as daemon , creating a server process
>c:\program files\mongodb\bin>mongod--port 10220--fork--dbpath "C:\Program files\mongodb\data\db"--logpath "C : \program Files\mongodb\data\log\mongodb.log "
Forked process:44086
All output Going To:MongoDB.log
The introduction of these several installations is completed.
4. Stop MongoDB
The most secure way to stop all current operations and save cached data to disk
>user Admin
>db.shutdownserver ();
Of course, we can also close the process directly, but this will cause the data in the cache to be saved to disk without urgency and lost. The next chapter is MONGO for. NET developed.