MongoDB Datatypes - MongoDB

How many datatypes are there in MongoDB?

MongoDB supports many datatypes. Below mentioned are few of the datatypes

  • String − String is most widely used datatype for storing data. String in MongoDB must be UTF-8 valid.
  • Integer − Integer type is used for storing a numerical value. Integer can be 32 bit or 64 bit based upon your server.
  • Boolean − Boolean type is used for storing a boolean (true/ false) value.
  • Double − Double type is used for storing floating point values.
  • Min/ Max keys – Min / Max keys type is used for comparing a value against the lowest and highest BSON elements.
  • Arrays − Arrays type is used for storing arrays or list or multiple values into one key.
  • Timestamp – timestamp is used to record when a document has been modified or added.
  • Object − Object datatype is used for embedded documents.
  • Null − Null type is used for storing a Null value.
  • Symbol − Symbol datatype is used identically to a string; though, it is commonly reserved for languages which use a specific symbol type.
  • Date − Date datatype is used for storing 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 – Object ID datatype is used for storing the document’s ID.
  • Binary data – Binary data datatype is used to store binary data.
  • Code − Code datatype is used for storing JavaScript code into the document.
  • Regular expression – Regular expression datatype is used for storing regular expression.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

MongoDB Topics