First, NoSQL
Learn about MongoDB before you know that Nosql,nosql is not the only SQL abbreviation. Consists of storage and retrieval techniques that provide a restrictive model that lacks SQL relational databases. It is primarily simplified design, horizontal scaling, and finer control over the availability of data. NoSQL has a variety of technologies such as the key-value structure of REDIS, the column structure of HBase, and so on.
Second, Mongodb
MongoDB is also a kind of nosql. It is based on a document model that stores data objects as separate documents in a collection. It is used to provide high-performance, high-availability, and automatically scalable data storage.
Three, the collection
MongoDB groups data together by using collections. A collection is simply a set of documents that have the same or similar purpose. Sets a table similar to a traditional SQL database. Only collections do not perform strict patterns, and documents in the same collection can have a slightly different structure from each other.
Iv. Documentation
A document is a representation of a single data entity in a MongoDB database. The row data for SQL is flat, and each value in the row has a column. Documents in MongoDB can contain embedded subdocuments, thus providing the application with a closer internal data model. The record representing the document in MongoDB is stored as Bson, which is a lightweight binary form of JSON. Its field/value corresponds to the properties and values of JavaScript. At the same time the maximum size of the file in MongoDB is 16MB. This prevents excessive RAM usage or severe impact on the file system.
Additionally, the document's field name cannot contain (null) characters, periods (.) or dollar sign ($). The _id field name is reserved for the object's ID. The _id field is a unique ID in the system and consists of the following parts:
1. A 4-byte value that represents the number of seconds in the past since the era.
2. A 3-byte machine identifier
3. A 2-byte process ID
4. A 3-byte counter, starting with a random value
V. MONGODB data type
MongoDB assigns an integer ID number from 1 to 255 for each data type, which you can use to query by type.
Type description Number
double double-precision values 1
string Strings 2
Object 3
Array Arrays 4
Binary binary Data binary 5
Object ID 7
Boolean Boolean value 8
Date 9
Null empty value 10
Regular expression Regex 11
JavaScript JavaScript 13
Symbol 14
JavaScript (with scope) JavaScript (in scope) 15
32-bit Intger 32-bit integer 16
Timestamp time Stamp 17
64-bit integer 64-bit integer 18
Min Key Minimum value 255
Max Key Max value 127
When comparing the values of different Bson types, Nongodb uses the following comparison order from lowest to highest:
1. Minimum key (internal type)
2. Null value
3. Values
4. Symbols, strings
5. Objects
6. Arrays
7. Binary data
8. Object ID
9. Boolean values
10. Date, time stamp
11. Regular Expressions
12. Maximum key (internal type)
MongoDB Database Basics