MongoDB (7) MongoDb Data Structure

Source: Internet
Author: User
First, insert a piece of bjson data to the database. First, define the document, and then use the admin username and password to log on to the test database, insert this document ("table name and record in table") to the test database and view the Vue details shown in vcD4KPHA + pgltzybzcm9www. 2cto. comuploadfileCollfiles

First, insert a piece of bjson data to the database. First, define the document, and then use the admin username and password to log on to the test database, insert this document (Table Name and record in table) into the test database to see vcD4KPHA + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles, as shown in.

First, insert a piece of bjson data into the database.

First, define the document, and then use the admin user name and password to log on to the test database. insert this document ("table name and record in table") into the test database ")



Insert the result and view the example Vue, as shown in. <喎?http: www.2cto.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles/20141018/2014101809021913.png" alt = "\">

It can be seen that the system's three databases, local, admin, and test, will automatically generate the _ id automatic identification when adding a record.

We can add images by using Vue, as shown in.

Mysql tables.

In a relational database, each table in a relational database is a ing of a relational model. The fields in each table are the attributes of the corresponding object and the set of primary and Foreign keys. Each field needs to be defined in advance.

Document: the user set ("table") here has a document (document can be understood as a record in mysql ). A document is the basic unit for mongodb to store data. The data storage structure is in BSON format, that is, the document we started to add, the key-value type.

The data type stored in the document can be: null, boolean, String, Object, 32-bit integer, 64-bit integer, 64-bit floating point number, date, regular expression, js Code, binary data, array, embedded document, maximum value, minimum value, undefined type.

GridFS: because the size of bson objects is limited, it is not suitable for storing large files. The GridFS file system provides a storage solution for large files, the fs in GridFS stores large files such as images and visual screens.

Whether it is a bson object or a large file stored in GriFs, we find that when a document is added, _ id is automatically added, the difference is that _ id, chunkSize, md5, legnth, and aliases are automatically added after the image is uploaded and analyzed by mongodb, the system automatically saves the file.

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.