Properly install MongoDB under Windows system

Source: Internet
Author: User
Tags install mongodb mongodb server

1. Download, install

Official website Download: http://www.mongodb.org/downloads

after the download, install it next:

2. Create a Data folder

MongoDB stores the Data folder under the DB folder.

However, this data folder is not actively created and we need to create it after the installation is complete. Please note that. The data folder should be placed under the root folder (for example, C: \ or D:\. , etc.).
In this tutorial. We already have MongoDB installed on C: disk, now let's create a folder of data and create a DB folder in the Data folder.


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 folders through the Windows Explorer. Not necessarily through the command line.

3. Execute MongoDB server under command line

In order to execute mongodbserver from the command prompt, you must execute the Mongod.exe file from the Bin folder of the MongoDB folder.

mongod.exe --dbpath c:\data\db

Assuming the execution succeeds, it outputs such as the following information:

Then, in the browser address bar, enter:localhost:27017

4. Execute mongodbserver as a Windows service

You can actually set MongoDB as a Windows service. In fact, it is painful to start MONGO every time through the command line. We therefore need to establish a permanent service. This will require us to add MONGO to the Windows Local Service.

This operation is for convenience, each time the boot MongoDB on their own initiative to start.

Installing MongoDB as a Windows service is easy, just need to add –install after the command line executed above

mongod--dbpathD:\MongoDB\data--install  (不成功)

But after the examination of the discovery did not succeed, heartbreak ...

After. In the site to find the reason, said to Win7 and Win8 64 bit will appear such a problem.

Well, I served you.

Then find a solution, here is the solution I found. Such a configuration as the following finally succeeded, happy.

Verify that the configuration is successful:

OK, fix it!!

5. MongoDB Background Management Shell

Suppose you need to get into MongoDB backend management. You'll need to open the Bin folder under the MongoDB folder and execute the mongo.exe file. The MongoDB Shell is an interactive JavaScript shell that comes with MongoDB and is used to manipulate and manage MongoDB.
When you enter MongoDB backstage. It is linked to the test document (database) by default:

Because it is a JavaScript shell, you can perform 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.