Data Types in mongoDB

String

Sting is the most common used data-type to store the data. String in mongoDB must be UTF-8 valid.

Integer

Use to store a numerical value. Integer can be 32 bit or 64 bit depending upon your server.

Boolean

Use to store a Boolean (true/ false) value.

Double

Use to store floating point values.

Symbol

This data-type is used identically to a string however, it's generally reserved for languages that use a specific symbol type.

Date  

Use to store the current date or time in UNIX time format. You can specify your own date time by creating object of Date and passing day, month, year into it.

Object ID  

Use to store the document’s ID.

Binary data

Use to store binary data.

Code

Use to store JavaScript code into document.

Regular expression

Use to store regular expression

Min/ Max keys  

This type is used to compare a value against the lowest and highest BSON elements.

Arrays  

Use to store arrays or list or multiple values into one key.

Timestamp

This can be handy for recording when a document has been modified or added.

Object

This data-type is used for embedded documents.

Null


This type is used to store a Null value.