1. Storage type
The MongoDB document is similar to JSON. But not completely JSON. There are only six types of JSON: null. bool Number, String. Array. Object.
However, MONGO's documentation extends several types on the basis of JSON. For example, a date type, an integer, a floating-point number.
MongoDB is really stored on disk using Bson (binary JSON).
2. Frequently used data types
Null: Indicates a nonexistent or null value.
Bool:true and False. String: strings, including with an argument.
3. Digital
There are only numeric types in JSON.
There are three kinds of MongoDB: 32-bit integer 64-bit integer 64 is floating-point number by default, it is stored according to floating-point numbers.
4. Date
The date type stores the number of milliseconds starting from the standard era.
{"X": New Date ()}
5. Arrays
Ability to store arrays
{"X": ["a", "B", "C"]}
6. Inline documentation
Use a document as a value for a document.
{"X": {"foo": "Bar"}}
7. _id
The MONGDB document must have a "_id" key. The default is a Objectid object. The Objectid uses 12 bytes of storage space, two bits per byte, 16 binary digits, and is a 24-bit string. Allocations such as those seen in the
The first four bytes are timestamps. Because in front, the objectid is probably sorted according to the timestamp.
Use it as an index to increase efficiency.
The PID is the process identifier and the counter is the counter per second. The ability to generate three times per second (16*16 = 256).
_ID can program to generate, without the system's own initiative, this need to ensure that each ID can not be repeated.
8. Other
The document can also include regular expressions, JavaScript code, and binary data.
Address: http://blog.csdn.net/yonggang7/article/details/25510377
Data types supported by MongoDB documents