MongoDB Data Type

Source: Internet
Author: User
Tags mongodb documentation

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.

   
   
   
   
   
   
Related Article

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.