Data type in MongoDB
MongoDB supports many different data types. The following are some typical data types.
MongoDB supports many of the data types listed below:
String : This is the most commonly used data type for storing data. MongoDB strings must be valid UTF-8.
Integer : This data type is used to store a numeric value. The integer can be 32 bits or 64 bits depending on your Server.
Boolean : This data type is used to store a Boolean value (true / false).
Double : This data type is used to store floating point real number values.
Min / Max keys : This data type is used to compare a value with the lowest and highest BSON elements.
Array : This data type is used to store arrays or lists or multiple values into a key.
Timestamp : Convenient for recording or marking when a Document is modified or added.
Object : This data type is used for embedded documents.
Null : This data type is used to store a Null value.
Symbol : This data type is used like a string, however, it is generally reserved for languages that use specific symbol types.
Date : This data type is used to store the current date and time in UNIX time format. You can specify your own date time by creating a Date object and passing the date, month, and year into it.
Object ID : This data type is used to store the Document ID.
Binary data : This data type is used to store binary data.
Code : This data type is used to store JavaScript code into Document.
Regular expression : This data type is used to store Regular Expresion.
According to Tutorialspoint
Previous post: Delete Collection in MongoDB
Next lesson: Insert Document in MongoDB
You've just finished reading the article "Data type in MongoDB" edited by the TipsMake team. You can save data-type-in-mongodb.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.