MongoDB documentation is similar to JSON format
JSON data type:
JSON contains six data types, including null, Boolean, number, String, array, and object. there is no date type in JSON, and there is only one numeric type. There is no way to distinguish between integer and floating-point numbers, not 32-bit and 64-bit.
MongoDB Data Type
MongoDB retains the JSON key value feature and adds some other data types.
Null |
Used to indicate that a null value has a non-existent word field. |
32-bit integer |
There is only one numeric type in Javascript, and MongoDB has the above three types. By default, shell numbers are treated as dual-precision by MongoDB. Modifying the 32-bit integer in the document under shell will also be converted to a 64-bit floating point number. So try not to modify the document below Shell |
64-bit integer |
64-bit floating point number |
String |
UTF-8 string data |
ID and objectid |
The document stored in MongoDB must have a "_ id". This key can be any value. The default value is the objectid object. In the collection, each document has a unique "_ id" to ensure that each document in the set is uniquely identified. Objectid is the default object of "_ id" in MongoDB. The generation method is a bit like UUID, and a unique value can be used on different machines. |
Date |
Date type storage is the number of milliseconds from the standard epoch, not the time zone |
Regular Expression |
Use the regular expression syntax of JavaScript |
Code |
JavaScript code, such as {A: function (){......}} |
Binary |
String composed of any byte |
Maximum and minimum |
It is a special type in bson that represents the maximum and minimum possible values respectively. |
Undefined |
Undefined. In JavaScript, null and undefined are different types. |
Array |
The set of values is represented as an array. Like a JSON array, an array is a set of values that can be operated as an ordered object (queue, stack, etc.) or as an unordered object, an array can contain objects of different data types, or even nested arrays. |
Embedded document |
A document can contain other documents or be embedded into a parent document. The embedded document treats the entire MongoDB document as the key value of another document. Like arrays, MongoDB can understand the structure of embedded documents, build indexes, execute queries, update, and so on. |
|
|
|
|
|
|
|
|
|
|
|
|