In this tutorial you will learn about the data types of the MongoDB database.
MongoDB Data Types - Learn about the data types of the MongoDB database
MongoDB as the cross platform agile database supports a variety of data types. Here we introduce all the MongoDB data types in brief.MongoDB as a cross platform database supports an array of data types which we will introduce here briefly. After reading this tutorial you will be able to use the correct data types in your applications.
String : String is the most common data type which is used to store data. UTF-8 validation is must for String in MongoDB.
Integer : Integer is a data type which is used to store numerical value. Depending upon the server Integer can be 32 bit or 64 bit.
Boolean : Boolean refers to true or false value of a data. This data type is used for storing true or false value.
Double : For storing floating point values this type of data is used.
Min/ Max keys : For comparing value against the lowest and highest BSON elements this data type is used.
Arrays : List of multiple values is designated as Arrays. This data type is used for storing an extensive list of multiple values into just one key.
Timestamp : Timestamp refers to the marked details corresponding to the modification or change in a document. This data type is extremely helpful for keeping track of the information concerning modification or addition in a document.
Object : Object is the type of data that is particularly used for embedded documents.
Null : Null is the data type used to store a null value.
Symbol : Though this data type is much like the String data type, it is mostly used for languages with a particular type of symbol.
Date : Date refers to the data type corresponding to date or time in UNIX time format. By creating object of Date and time attributes like month, year, etc. you can incorporate your preferred time structure.
Object ID : Object ID is the data type which is used for storing ID of documents.
Binary data : For storing binary data this type of data is used.
Code : For the purpose of storing JavaScript code into document this type of data is used.
Regular expression : For storing regular and frequent expressions this data type is used.
Next tutorial: MongoDB Indexing
[ 0 ] Comments