First, insert a Bjson data into the database
The first is to define the document, then log in with the admin username password, enter the test database, insert this document into the test database ("table name and records in table")
Insert results, view Mongovue as shown
We can see that the system comes with three databases, local,admin,test, when adding a record, will automatically generate _id automatic identification.
We'll add the picture again, which can be added using Mongovue, as shown in.
Collections: Called a collection in MongoDB, is a collection of documents. No mode, you can store a variety of documents. Like a table in MySQL.
In a relational database, each table in a relational database is a mapping of a relational model, and each table field is a collection of attributes and primary foreign keys for the corresponding entity, and each field 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 for MongoDB to save data. The data is stored in the Bson format, which is the document we started to add, the key value pair type.
The document can be saved to a data type that is: 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, it is not suitable for storing large files, Gridfs file system provides a storage scheme for large files, and the FS under Gridfs is saving large files such as pictures and video screens.
Whether it is a Bson object or a large file stored in the grifs, we find that when a document is added, it is automatically added _id, the difference is that the image is added automatically after the addition of _id,chunksize,md5,legnth,aliases, etc. These properties are after we upload the image, after MongoDB analysis automatically added, the system automatically saved.
MongoDB (vii) MONGODB data structure