1. Storage type
The MongoDB document is similar to JSON, but not full JSON. There are only six types of JSON: null, BOOL, number, string, array, object. But MONGO's documents also extend several types, such as date types, integers, and floating-point numbers, based on JSON.
MongoDB is really stored on disk using Bson (binary JSON).
2. Common data types
Null: Indicates a nonexistent or null value. Bool:true and False. String: strings, enclosed in quotation marks.
3. Digital
There are only numeric types in JSON. There are three types of MongoDB: 32-bit integer 64-bit integer 64 is the floating-point number by default, which is stored by floating-point numbers.
4. Date
The date type stores the number of milliseconds that start from the standard era.
{"X": New Date ()}
5. Arrays
can store arrays
{"X": ["a", "B", "C"]}
6. Inline documentation
Use one document as a value for another document.
{"X": {"foo": "Bar"}}
7. _id
The MONGDB document must have a "_id" key, which is a Objectid object by default. The Objectid uses 12 bytes of storage space, two bits per byte, 16 decimal digits, and 24-bit strings. Allocation as shown
The first four bytes are timestamps. Because in front, the Objectid is probably sorted by timestamp. Use it as an index to increase efficiency. The PID is the process identifier and the counter is the counter per second. Three times per second (16*16 = 256) can be generated.
_ID can be generated by the program, without the system automatically, it is necessary to ensure that each ID cannot be duplicated.
8. Other
The document can also contain regular expressions, JavaScript code, and binary data.
Address: http://blog.csdn.net/yonggang7/article/details/25510377