I. first install MongoDB
1. Download mongodb:http://www.mongodb.org/downloads on the website and select the Windows platform. When installed, all the way next is available. I installed it in the F:\mongoDB directory.
2. Create a working directory:
- New data storage directory in MongoDB directory: F:\mongoDB\data\db
- Create a new log file in the MongoDB directory: F:\mongoDB\log\mongodb.log
3. Run Cmd.exe (open as Administrator) and go to the F:\mongoDB\bin directory and execute the following command
> F:\mongodb\bin>mongod-dbpath "F:\mongoDB\data\db"
If the boot succeeds, the MongoDB default listening port is displayed: 27017,mysql is 3306
Enter http://localhost:27017/in the browser. will appear:
It looks like you is trying to access MongoDB over HTTP on the native driver port.
Indicates that the service has started.
4. Test the connection
Open a new CMD window, enter the MongoDB bin directory, enter MONGO or Mongo.exe, the following message shows that the test passed, at this time we have entered the test database. (Prerequisite: Open Mongod.exe in Bin directory)
5. When the Mongod.exe is turned off, Mongo.exe will not be able to connect to the database, so each time you want to use the MongoDB database to open the Mongod.exe program, it is more troublesome, at this time we can install MongoDB as a Windows service
Or run cmd, go to the Bin folder and execute the following command
> D:\mongodb\bin>mongod--dbpath "d:\mongoDB\data\db"--logpath "D:\mongoDB\log\mongodb.log"--install-- ServiceName "MongoDB"
This happens because a Mongodb.log file has been created, but it doesn't matter. This has successfully installed MongoDB as a Windows service.
6. Start the MongoDB service: Also in the bin directory
>f:\monggodb\bin\net Start MongoDB
Open Task Manager and you can see that the process has started
7. Shutting down services and deleting processes
> F:\monggodb\bin>net Stop MongoDB (Close service)
> F:\monggodb\bin>mongod--dbpath "d:\monggoDB\data\db"--logpath "D:\monggoDB\data\log\MongoDB.log"--remove- -servicename "MongoDB"
(Delete, note not--install.)
Two.MongoDB background Management Shell
1. If you need to enter MONGODB background management, you need to open the next bin directory of the MongoDB directory, and then execute the mongo.exe file, MongoDB Shell is the interactive JavaScript shell that comes with MongoDB, An interactive environment that is used to manipulate and manage MongoDB.
When you enter MongoDB background, it is linked to the test document (database) by default:
Since it is a JavaScript shell, you can run some simple arithmetic operations:
The db command is used to view the document (database) of the current operation:
Insert some simple records and look for it:
The first command inserts the number 10 into the X field of the Runoob collection.
Reference: http://www.lai18.com/content/6136272.html
Windows Platform MongoDB installation configuration