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