Data Types supported by the mongodb documentation

Source: Internet
Author: User
Tags mongodb documentation
1. Storage-type mongodb documents are similar to json, but not completely json. Json has only six types: null, bool, number, String, array, and object. However, the mongo documentation also extends several types based on json, such as date, integer, and floating point. Mongodb uses bson (binaryjson) to store data on disks)

1. Storage-type mongodb documents are similar to json, but not completely json. Json has only six types: null, bool, number, String, array, and object. However, the mongo documentation also extends several types based on json, such as date, integer, and floating point. Mongodb is actually stored on disks using bson (binary json)

1. Storage-type mongodb documents are similar to json, but not completely json. Json has only six types: null, bool, number, String, array, and object. However, the mongo documentation also extends several types based on json, such as date, integer, and floating point.
Mongodb uses bson (binary json) to store data on disks ). 2. Common Data Type: null indicates no or null. Bool: true and false. String: string, enclosed in quotation marks. 3. Only the numeric type is in the numeric json. There are three types of mongodb: 32-bit integer 64-bit integer 64 is a floating point number, which is stored according to the floating point number by default. 4. Date and date types are stored in milliseconds starting from the standard epoch.
{"x" : new Date()}
5. Arrays can store arrays.
{"x" : ["a", "b", "c"]}
6. embedded documents use one document as a value for another document.
{“x” : {"foo" : "bar"}}
7. The _ idmongdb document must have a "_ id" key, which is an ObjectId object by default. ObjectId uses 12 bytes of storage space. Each byte has two hexadecimal digits and is a 24-Bit String. Shows the allocation.
The first four bytes are timestamps. Since the previous steps lead to Objectid sorting by timestamp. Use it as an index to improve efficiency. Pid is the process identifier and the counter is the counter per second. The second can generate the 3rd power of (16*16 = 256.
_ Id can be generated by a program without being automatically generated by the system. Therefore, each id must be unique. 8. Other documents can also contain regular expressions, javascript code, and binary data.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.