Skip to main content

MongoDB - Datatypes

MongoDB supports many datatypes. Some of them are listed below:

DatatypeDescription
StringStores UTF-8 valid strings.
IntegerStores 32-bit or 64-bit numerical values.
BooleanStores a boolean value (true/false).
DoubleStores floating-point values.
Min/Max KeysUsed to compare values against the lowest and highest BSON elements.
ArraysStores arrays or lists of multiple values.
TimestampStores timestamps, useful for recording modification or addition times.
ObjectUsed for embedded documents.
NullStores a Null value.
SymbolUsed identically to a string, reserved for specific languages.
DateStores the current date/time in UNIX format.
Object IDStores the documentโ€™s ID.
Binary DataStores binary data.
CodeStores JavaScript code in the document.
Regular ExpressionStores regular expressions.

Datatype Diagramโ€‹