MongoDB - Data Types

MongoDB - Data Types

MongoDB supports many data types. Some of them -

String is the most commonly used data type for storing data. A string in MongoDB must be valid UTF-8.

Integer - This type is used to store a numeric value. The integer can be 32-bit or 64-bit depending on your server.

Boolean − This type is used to store boolean (true/false) value.

Double - This type is used to store floating point values.

Min/Max Keys − This type is used to compare the value with the lowest and highest BSON elements.

Arrays − This type is used to store arrays or a list or multiple values ​​in one key.

Timestamp − 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.

Character - This data type is used identically to a string; however, this is usually reserved for languages ​​that use a certain type of character.

Date - This data type is used to store the current date or time in UNIX time format. You can specify your own date and time by creating a Date object and passing in the day, month, year.

Object ID - This data type is used to store the ID of the document.

Binary Data − This data type is used to store binary data.

Code - This data type is used to store the JavaScript code in the document.

Regular Expression - This data type is used to store a regular expression.