Getting started with MongoDB

Source: Internet
Author: User

I. Introduction
NoSQL databases become more and more popular because of their scalability. Using NoSQL databases can bring you more benefits. MongoDB is an open-source NoSQL database compiled in C ++ with high scalability. This article describes how to install, configure, and run MongoDB. Http://www.mongodb.org

Ii. Download and install
Download Page: http://www.mongodb.org/downloads
The author uses MongoDB2.0.6 Windows Version: http://downloads.mongodb.org/win32/mongodb-win32-i386-2.0.6.zip
After the download is complete, decompress the package. For convenience, rename the decompressed folder to mongo. It is best to move it to a folder without spaces. I moved it to D: \ sdk \ MongoDB.

3. Configure the environment and start the service
MongoDB needs a data folder to store some of its files. The default path is the \ data \ db folder under the root directory of the disk where MongoDB is located. For example, you need to create a folder shown in the following path:
D: \ data \ db (the db folder must also exist; otherwise, an error will be reported when MongoDB \ bin \ mongod.exe is started)

To start the MongoDB server, you only need to double-click MongoDB \ bin \ mongod.exe. MongoDB runs on port 27017.
If you want to specify the data directory, for example, to specify the Directory D: \ sdk \ MongoDB \ data \ dbdirectory, you can run mongod.exe in a command line and specify the path at the same time:

  1. D: \ sdk \ MongoDB \ bin>Mongod -- dbpath D: \ sdk \ MongoDB \ data

For convenience, you can also create a batch for and start the mongod server.


4. Connect to MongoDB, save data, and query data. Run MongoDB \ bin \ cmd.exe to save two pieces of data:
  1. Db. test. save ({a: 1 });
  2. Db. test. save ({uid: 1, uname: "Siuon", age: 21 });
Query: db. test. find ();
  • 1
  • 2
  • Next Page

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.