Installation and setup of MongoDB service under Windows MongoDB

Source: Internet
Author: User

Mongo DB is a non-relational database (NOSQL) that is currently very popular in the IT industry, and its flexible data storage methods are highly favored by current it practitioners. Mongo DB is a good implementation of object-oriented thinking (Oo idea), in Mongo db each record is a document object. The biggest advantage of Mongo DB is that all data persistence requires no developers to write SQL statements manually, and it is easy to invoke methods to implement CRUD operations.

  1. Download:http://www.mongodb.org/downloads

    This is not to say, download the corresponding system 32/64-bit installation package

  2. Installation: E:\Work_App\MongoDB (installed in a dedicated directory)

    Configuration:

    1. Create a new Data folder under E:\Work_App\MongoDB\

    2. Create a new db and log folder under E:\Work_App\MongoDB\Data

    3. Create a new MongoDB.log file under E:\Work_App\MongoDB\data\log

  3.  

    start MongoDB:

    Enter E:\Work_App\MongoDB\bin,

    Input:mongod -dbpath  "E:\Work_App\MongoDB\Data\db"

    Role: Create a MongoDB database file to E:\Work_App\MongoDB \data\db directory

    Note:

    1, note is Mongod.exe

    2, this time the interface will stop at 2015-03-26t15:19:17.135+0800 i network   [initandlisten] waiting for connections on port 27017  (The database is now started)

  4. First knowledge of MongoDB:

    New Open [ Note is new ] after a cmd window, then run the Mongo.exe program (note that there is no d), at this time the previous window is displayed: 2015-03-26t15:31:10.148+0800 I NETWORK [ Initandlisten] Connection accepted from 127.0.0.1:60408 #1 (1 connection now OPEN)

    Now it's time to use the MongoDB database.

    >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)

    END
Start MongoDB as a Windows service
    1. Sign up for MongoDB Service

      Entry: E:\Work_App\MongoDB\bin

      Input: Mongod-dbpath "E:\Work_App\MongoDB\Data\db"-logpath "E:\Work_App\MongoDB\Data\log\MongoDB.log"-install- ServiceName "MongoDB" (this must be run as Administrator)

      At this point the service is installed successfully, running

      >net Start MongoDB (open service)

      >net Stop MongoDB (shutdown service)

    2. Delete MongoDB Service

      Mongod-dbpath "E:\Work_App\MongoDB\Data\db"-logpath "E:\Work_App\MongoDB\Data\log\MongoDB.log"-remove- ServiceName "MongoDB"

Installation and setup of MongoDB service under Windows MongoDB

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.