MongoDB Quickstart for Windows

Source: Internet
Author: User
Tags install mongodb mongodb server mongo shell
Document directory
  • Download
  • Unzip and install
  • Create a data directory
  • Run and connect to the MongoDB Server
  • Further study
Original address: http://tq-zone.appspot.com/mongodb_quickstart_windows
  1. Download
    1. 32-bit version
    2. 64-bit version
  2. Unzip and install
  3. Create a data directory
  4. Run and connect to the MongoDB Server
  5. Further study

Download

Directly Using pre-compiled binary files to install MongoDB is the simplest and recommended method.

32-bit version

. We recommend that you download the production release version, but it is stable.

64-bit version

.

Note: We recommend that you use a 64-bit version of MongoDB. Of course, you must use it on a 64-bit Windows platform.

Unzip and install

Decompress the downloaded file to any directory (C: \ is a good choice ). For convenience, you can change the directory name MongoDB-xxx to Mongo. In fact, the installation has been completed.

Create a data directory

By default, MongoDB stores the data in the \ data \ dB path, but does not automatically create it. Therefore, we need to manually complete it.

 

 C:> mkdir \data C:> mkdir \data\db

 

Of course, you can also perform this operation on my computer.

Run and connect to the MongoDB Server

The home page uses two important files:

  • Mongod.exe-MongoDB database server program
  • Cmd.exe-shell used for management

To start the MongoDB database, you can double-click d.exe on "My Computer" or execute the following statement in the command line window:


 C:> cd \my_mongo_dir\bin
C:\my_mongo_dir\bin > mongod

 

Note: there are still some problems with using the MongoDB database server program as a Windows service, but it will be implemented in the future.

Now let's start the Administrator shell. You can double-click cmd.exe in "My Computer" or run it in the command line window. In bad condition, cmd.exe connects to the mongod server running on localhost and opens the test database. Run Mongo -- help to view other options.


Code

 C:> cd \my_mongo_dir\bin
C:\my_mongo_dir\bin> mongo
> // the mongo shell is a javascript shell connected to the db
> 3+3
6
> db
test
> // the first write will create the db:
> db.foo.insert( { a : 1 } )
> db.foo.find()
{ _id : ..., a : 1 }

 

 

Congratulations! We have completed the first step of using MongoDB.

Further study
  • Tutorial
  • Windows Quick Links
  • Mongo Shell
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.