Data type in MongoDB

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

4 ★ | 1 Vote

May be interested

  • Projection in MongoDBProjection in MongoDB
    in mongodb, projection's meaning is to select only the necessary data instead of selecting the entire data of a document. if a document has 5 fields and you only need 3 fields, you should only select 3 fields from that document.
  • How to save React form data in Mongo DatabaseHow to save React form data in Mongo Database
    try adding mongodb to your web stack to see how easy it is to store and query form data!
  • Create Backup in MongoDBCreate Backup in MongoDB
    to create a database backup in mongodb, you should use the mongodump command. this command will dump all server data into dump directory. there are many options available from which you can limit the amount of data or backup created by remote server.
  • Covered Query in MongoDBCovered Query in MongoDB
    when all fields in the query are part of the index, mongodb connects query conditions and returns the result by using the same index without looking inside the document. when indexes are present in ram, retrieving data from indexes is faster when compared to retrieving data by scanning all documents.
  • MongoDB malicious code attacks more than 26,000 victims in a weekMongoDB malicious code attacks more than 26,000 victims in a week
    malware that attacks the mongodb database has rekindled last week and after the weekend with the arrival of three new groups hijack more than 26,000 servers, of which one group attacked 22,000 machines.
  • Learn about security features and authentication in MongoDBLearn about security features and authentication in MongoDB
    in the following article, we will continue to introduce security and authentication features in the mongodb database management system series. in essence, the basic account validation feature is available in mongodb, but has been disabled in default mode, and in this mode the system requires at least 1 active database ...
  • ObjectId in MongoDBObjectId in MongoDB
    you have seen the use of mongodb objectid in previous chapters. in this chapter, we will understand the structure of objectid.
  • Replica Set in MongoDBReplica Set in MongoDB
    replication is the process of synchronizing data from multiple servers. replication provides redundancy and increased data availability for multiple data copies on many different database servers. replication protects a database from the loss of a particular server. replication also allows you to recover data from hardware errors or service disconnections. with additional data copies, you can use it for recovery, reporting, or backup.
  • Text Search in MongoDBText Search in MongoDB
    starting with version 2.4, mongodb started supporting text indexes to search within the string content.
  • Learn about Java Driver in MongoDBLearn about Java Driver in MongoDB
    in the following article, we will introduce you some basic features of mongodv java driver as well as how to deploy and apply in practice.