1. Download, install
Official website Download: http://www.mongodb.org/downloads
after the download, install it next:
2. Create Data Catalog
MongoDB stores the data directory in the DB directory. However, this data directory is not actively created, and we need to create it after the installation is complete. Note that the data directory should be placed under the root directory (e.g. C: \ or D:\. , etc.).
In this tutorial, we've installed MongoDB on the C: disk, now let's create a directory of data and then create the DB directory in the data directory.
C:>CD c \
C:>mkdir data
C:>CD data
C:\data>mkdir DB
C:\DATA>CD DB
C:\data\db>
You can also create these directories through the Windows Explorer, not necessarily through the command line.
3. Run MongoDB server under command line
In order to run the MongoDB server from the command prompt, you must execute the Mongod.exe file from the bin directory of the MongoDB directory.
mongod.exe --dbpath c:\data\db
If the execution succeeds, the following information is output:
Then, in the browser address bar, enter:localhost:27017
4. Run the MongoDB server as a Windows service
You can actually set up MongoDB as a Windows service. In fact it is painful to start MONGO every time through the command line, so we need to create a permanent service, which requires us to add MONGO to the Windows Local Service. This operation is for convenience, each time the power on MongoDB will automatically start.
Installing MongoDB as a Windows service is simple, just add –install after the command line that you executed above
mongod--dbpathD:\MongoDB\data--install (不成功)
But after examining it, I found it was not successful, and my heart was broken.
After that, on the site to find the reason, said to Win7 and Win8 64 bit will appear this problem. Well, I served you. Then go to the solution, the following is the solution I found, like the following configuration, the final success, happy.
Verify that the configuration is successful:
OK, fix it!!
5. MongoDB Background Management Shell
If you need to get into MongoDB background management, you need to open the bin directory under the MongoDB directory first, 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:
> 2 + 24>
The DB command is used to view the document (database) of the current operation:
> dbtest>
Insert some simple records and look for it:
> db.runoob.insert({x:10"nInserted"1 })> db.runoob.find"_id" : ObjectId("5604ff74a274a611b0c990aa""x"10 }>
The first command inserts the number 10 into the X field of the Runoob collection.
Properly install MongoDB under Windows system