MongoDB Data Types

MongoDB Data Types

There are various types of data that are used and are supported in MongoDB. The most common data types of MongoDB are:

 Arrays:

An array is a single variable which can store multiple values at a time. An array in MongoDB is used to hold many values under a single key.

Boolean:

A boolean data type consists of only two values: 0 or 1 (i.e, TRUE or FALSE).

Date:

In order to specify a particular date time or to store the current date time in unix time format, Date datatype is used in MongoDB.

Double:

Double also represents all the decimal and exponential numbers.

Integer:

All the non-decimal numbers are called as Integers. The size of an integer depends on the server; 32 bit or 64 bit.

Min/Max Keys:

In order to compare a value against the lowest and highest bson elements, Min/Max data type is used in MongoDB.

Null:

As the name suggests, NULL type of data is used to represent no value or zero value.

Object:

Anything that has state and behavior can be termed as an Object, be it physical or logical. An Object is a data type in MongoDB which is frequently used for embedded documents.

String:

A sequence of characters, internally stored in the form of an array of characters is called as string. The UTF-8 string is used to store data in MongoDB.

Symbol:

Symbol is an unique type of data facilitated by MongoDB which is used for languages that use a specific type.

Please Share