First knowledge of MongoDB

Source: Internet
Author: User
Tags robomongo

Brief introduction:

MongoDB is an open source document database that supports high performance, high availability, and Autoscale.

In MongoDB, a record is a document that consists of field and value pairs that form a data structure, similar to a JSON object. The value of a field can include an array of other documents, arrays, and documents.

The data structure is as follows:

There are three triples in MongoDB: The database, the collection, the document, the "collection" is "table" in the corresponding relational database, "document" corresponds to "row".

Download MongoDB and the Robomongo :

Download MongoDB software to MONGO website . MongoDB supports Windows, Linux, OSX, Solaris Four platforms, you can according to their own system, download the corresponding version of MongoDB. When downloading, pay attention to two points:

①: According to industry rules, even "stable" (for example: 2.0.x,2.2.x), Odd for "development" (e.g. 2.1.x,2.3.x).

②: 32bit MongoDB can only store 2G of data, 64bit there is no limit.

I am currently using the WINDOWS10 operating system, 64bit. The download is: mongodb-win32-x86_64-3.0.7 this version. Available here in 32bit and 64bit domestic.

Download the Robomongo software on the Robomongo website . Robomongo is a visual client tool for MongoDB. Robomongo is provided here in China.

Start MongoDB :

Put the downloaded MongoDB into the MONGO folder on the D drive and rename it to Mongod. Put the Robomongo into the MONGO folder on the D-Drive, renamed to Robomongo.

under the Mongod folder, create a new DB folder. Data that is used to store MongoDB.

Press the win key on the keyboard +r, enter the cmd carriage return. Launches a command-line window. Switch to D:\mongo\mongod\bin.

Perform Mongod--dbpath=. /db command.

 

: MongoDB is now running in Process number 10,368th (this process can be different every time) with the port 27017,dbpath. /db,host is the machine name of the machine.

Client link mongodb:

Press the win key on the keyboard +r, enter the cmd carriage return. Launches a new command-line window. Switch to D:\mongo\mongod\bin.

Input command: MONGO. The default connection is local, and the port is 27017 on the test database on the Mongod server.

Insert a record: Enter command: Db.person.insert ({"Name": "Ryan", "Age": 20})

Query the record, enter the command: Db.person.find ({})

Display results more than a "_id" this field, which is a mongodb automatically generated by an ID, followed by a detailed explanation of the ID of the composition, now just know is a non-duplicate ID.

Next, we use the Robomongo visualization tool to look at MongoDB data.

Double-click Robomongo.exe under the Robomongo folder (the tool is green, double-click to run), create a new connection, enter the hostname: localhost and port number 27017 (the default port for Mongod), and by default, no user name password is required.

After the connection, we can see the test database, double-click the person this collection, view the data inside. The display of data is divided into three kinds. Tree (you can see the type of field), table, text.

First knowledge of 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.