[Notes] ten power of MongoDB simple entry

Summary:
(1) the amount of data
(2) write operation frequently
(3) lower value
For such data, we use MongoDB for storing data to achieve
 
MongoDB is a cross-platform, document-oriented database, is currently the hottest NoSQL database products
A door of. It ranged between relational databases and non-relational databases, non-relational database functions among the richest and most
Like relational database products. It supports data structure is very loose, the BSON JSON format is similar, it can be
Storing complex data types.
MongoDB's official website address is: http: //www.mongodb.org/
 
 
MongoDB biggest feature is the query language supported by his very powerful, object-oriented syntax is somewhat similar to
Query language, most of the functionality can be achieved almost single-table queries similar to a relational database, but also to build support for data
Li index. It is a set-oriented, free model document database.
Specific features are summarized as follows:
(1) for collection storage, easy to store types of data objects
(2) a free mode
(3) support for dynamic queries
(4) support fully indexed, contain internal objects
(5) supports replication and failover
(6) using an efficient binary data storage, including large objects (e.g., video, etc.)
(7) automatically handles fragmentation, in order to support the expansion of the cloud level
(8) to support drivers Python, PHP, Ruby, Java, C, C #, Javascript, Perl and C ++ language
Sequence, the community also provides a driver for the Erlang and .NET and other platforms
(9) The file format is stored in the BSON (one kind of extension JSON)
 
 
MongoDB the logical structure is a hierarchical structure. Mainly by:
Document (document), collection (collection), database (database) This three-part. Logic structure surface
To the user, the user is using a logical structure to develop applications using MongoDB.
(1) MongoDB document (document), equivalent to a row in a relational database.
(2) composed of a plurality of documents set (collection), equivalent relational database table.
A plurality (3) collection (Collection), grouped together logically, that the database (database).
(4) a plurality of support MongoDB instance database (database).
Document (document), a collection (collection), database (Database) hierarchy as shown below:

 

 

 

 

Basic data types:
null: null value or for indicating the absence of a field, { "x": null}
Boolean: There are two types of Boolean values ​​true and false, { "x": true}
Value: shell default value of 64-bit floating point type. { "X": 3.14} or { "x": 3}. For integer values ​​may be used
NumberInt (4 byte unsigned integers) or NumberLong (8-byte signed integer),
{“x”:NumberInt(“3”)}{“x”:NumberLong(“3”)}
String: UTF-8 can be expressed as a string data type string, { "x": "Oh"}
Date: The date is stored as the number of milliseconds elapsed from the dependent era, the time zone is not stored, { "x": new Date ()}
Regular Expressions: query, use a regular expression as a qualification, and syntax of JavaScript regular expressions
With, { "x": / [abc] /}
Array: data list or data set may be represented as an array, { "x": [ "a", "b", "c"]}
Embedded documents: Document other documents can be nested, nested treated as a value document, { "x": { "y": 3}}
Object Id: Object id is a 12-byte string uniquely identifies the document, { "x": objectId ()}
Binary data: the data is a binary string of arbitrary byte. It can not be used directly in the shell. If you want to
Save the non-utf- characters into the database, binary data is the only way.
Code: query and a document may include any JavaScript code, { "x": function () {/ ... /}}
 
Installation and use: (Windows)
 
Double-click "mongodb-win32-x86_64-2008plus-ssl-3.2.10-signed.msi" follow presentation step install. After installation, the software will be installed in C: \ Program
Files \ MongoDB directory.
 
We want to start the service program is C: \ Program Files \ MongoDB \ Server \ 3.2 \ mongod.exe bin directory, in order to facilitate every time we start, I will be C: \ ProgramFiles \ MongoDB \ Server \ 3.2 \ bin is set to environment variable path.
 
start up
(1) First, open a command prompt, create a directory to store data for a
md d:\data
(2) to start the service
mongod ‐‐dbpath=d:\data
We can see in the start information, the default port is 27017 mongoDB
If we want to change the default startup port, the port can be specified by --port
At the command prompt, enter the following command to complete the landing
mongo
Exit mongodb
exit

 

MongoDB installed at Docker environment
1. Pull mirror
2. Create a container
 
docker run ‐di ‐‐name=tensquare_mongo ‐p 27017:27017 mongo

3. Remote Login

mongo 192.168.12.129

  

Guess you like

Origin www.cnblogs.com/gdut-lss/p/11521381.html