A preliminary summary of MongoDB Learning

Source: Internet
Author: User

What?

One of the most popular non-relational databases. Document-oriented databases are fundamentally different from relational databases in terms of data storage.

Why?

Simple to use
Adaptable to SQL-based DB for changing business needs
Performance
Copy
Index
Sharding
A rich query
Flexible data Model
No less than the speed
Good performance under massive data
Programmer-Friendly, but DBA nightmare, poor maintainability

Constitute

The organizational structure of MongoDB, as opposed to the database row-and-table SQL database, is: Document---collection

The document, collection, approximately corresponds to the concept of a row, table in a SQL-based database.

Document
    • ‘name‘ : ‘tom‘ , ‘age‘: 21 , ‘email‘: ‘[email protected]‘ }
      The previous example is a Document object. Document organizes data in the form of key:value (similar to JSON format), with the following notes in document:
  • Documents are sensitive to the order of multiple Key:value: for example:

      ‘name‘ : ‘tom‘ , ‘age‘: 21 , ‘email‘: ‘[email protected]‘
      ‘name‘ : ‘tom‘ ,  ‘email‘: ‘[email protected]‘,‘age‘: 21 }

    The above two documents are considered to be two different documents.

  • A key named for each document is added to _id the system. This key is a unique identity that the system has for the same colletion document .
      _idThe value is a special type in MongoDB: ObjectID() .
    MongoDB creates a key for a document when it is stored in the database, unless you specify the value of the attribute in the document _id .

  • Key

    • Key cannot be duplicated
    • The document's key is of type string
    • Document is case sensitive to key
  • Value
    • Values in a document can be of multiple types
    • Value can be a document (inline document)
Collection
      • Table equivalent to relational database
      • Collection is modeless: that is, a document of a different structure can belong to the same collection, which cannot be done in a relational database, as you cannot put two rows of different structures into the same table.

      • OK, since we can put different structure of document into the same collection, why do we need more than one collection?

      • In fact, we should put the same type of document in a collection, but that does not mean that we have a strong requirement for the structure of the data (document), and MongoDB allows us to manage the data more flexibly. Classifying documents means producing multiple collection that can also increase our access speed and reduce the burden on the server, while also allowing us to better organize and manage the data (MongoDB's DBA is a broken-winged angel for Life).

      • MongoDB supports a wide variety of data types, the main one being the extensible JSON-type data, summarized below:

        • Null
        • bool
        • Int32
        • Int64
        • Float64
        • String
        • Symbol
        • ObjectId ()
        • Date
        • Expressed as the number of milliseconds starting from the era
        • Regular expressions
        • JavaScript code
        • Binary data
        • Maximum Value (BSON)
        • Minimum value (BSON)
        • Undefined
        • Array
        • Cocument

        The following is a basic usage of the shell of MongoDB. To be Continued ...

A preliminary summary of MongoDB Learning

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.