MongoDB Series Tutorials (vii): MongoDB data Structure detailed _MONGODB

Source: Internet
Author: User
Tags mongodb

First, insert a Bjson data into the database

First, define the document, then log in with the admin username password, enter the test database, and insert this document into the test database ("table name and records in table")

Insert the results and view Mongovue as shown in the following figure

From the above figure can be seen from the system with three of the database, Local,admin,test, when adding a record, will automatically generate _id automatic identification.

We add the picture again, we can add it using Mongovue, as shown in the following figure.

Collections: called a collection in MongoDB, is a collection of documents. No mode, you can store a wide variety of documents. Similar to tables in MySQL.

In a relational database, each table in a relational database is a mapping of a relational model, and each table's fields are the properties of the corresponding entity and the collection of primary foreign keys, each of which needs to be defined in advance.

Document: The User collection ("table") here has a document (document can be understood as a record in MySQL). A document is a basic unit of MongoDB saving data. The storage structure of the data is the Bson format, which is the document we started adding, key value pair type.

The document can be saved to a data type: null, Boolean, String, Object, 32-bit integer, 64-bit integer, 64-bit floating-point number, date, regular expression, JS code, binary data, array, inline document, maximum, minimum, undefined type.

Gridfs: Because the size of the Bson object is limited, not suitable for storing large files, Gridfs file system for large files to provide a storage scheme, GRIDFS under the FS save is a picture, video screen and other large files.

Whether the Bson object or the large file stored in Grifs, we found that when adding a document, will automatically add _id, the difference is that the picture will automatically add after the addition of _id,chunksize,md5,legnth,aliases, These properties are uploaded after we upload the image, MongoDB analysis automatically added, the system automatically save.

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.