Various Data Types You Can Use in MongoDB | iCert Global

Blog Banner Image

MongoDB is widely recognized as fast, easy to scale, and ready to use. It supports multiple data types to store data intelligently and makes it easier for the database to search and operate on that data quickly and easily. Below are some types of data that are commonly used in MongoDB.

Getting Familiar with Data Types in MongoDB

MongoDB is a unique type of database that works well with thousands of concurrent users, allows you to easily scale to allow larger data sets, and is very fast. MongoDB also has data types that are unique to MongoDB to allow you to store and find information with great ease.

Let's take a refresher on some of the common data types used in MongoDB:

1. String

A string is made to hold text data. Anything made of letters, vocabulary, and sentences are typically string data types. Strings are among the most common types of data in MongoDB, and strings in MongoDB can support essentially all human languages thanks to its use of UTF-8.

 

 

Text (String)

In MongoDB, a text (or string) is one of the most popular types of data. It's used when we're storing words, letters, or sentences. To account for letters from different languages, MongoDB uses a special format (UTF-8).

Example:

json

CopyEdit

{

  "student_name": "Anita Roy",

  "student_class": "Grade 7",

  "student_marks": 88,

  "student_passed": true

}

In this case:

"student_name": "Anita Roy" and "student_class": "Grade 7" are text types, since they contain words.

2. Integer

Example:

json

CopyEdit

{

"student_name": "Riya Sharma",

"course": "Graphic Design",

"course_fee": 12000,

"is_enrolled": true

}

In this example, course_fee is integer as it contains a whole number.

 

 

3. Double

A double is a data type that stores decimal numbers. These can be numbers like 12.5 or 3.14 where the value is not a whole number.

Example:

json

CopyEdit

{

 "student_name": "Karan Patel",

 "course": "Mathematics",

 "test_score": 92.5,

"passed": true

}

'In this case, test_score is a double because it holds a number which has a decimal.

4. Boolean

A boolean is a datatype (data type) that can contain true or false. It is handy for asking yes or no questions. When you want to check a condition like yes/no or on/off.

Example:

json

CopyEdit

{

 "student_name": "Zara Khan",

"course": "Biology",

 "test_score": 88.0,

"passed": false

}

The passed field is a boolean because it indicates whether Zara passed or not using true or false.

5. Array

An array allows you to store multiple values under a single element. In MongoDB, this enables you to have a collection of things such as skills or topics.

Example:

json      

CopyEdit

{

"student_name": "Aman Joshi",

"subjects": ["Physics", "Chemistry", "Math"],

"average_score": 85.25,

"is_active": true

}

The subjects field is an array because it holds multiple values (three subjects).

 

6. Object

An Object is when a document has another document or documents inside. This is called an embedded document. An embedded document simply relates data and organizes it within a document.

Example:

json

CopyEdit

{

 "student_id": "STU2025",

"student_name": "Meena Kapoor",

"student_address":{

"street": "Green Park Road",

 "city": "Delhi",

"zip": 110016

 }

  "student_active": true

The student_address has its own attributes (street, city, zip) so that is why it is considered an object.

7. Date

Date is used to store date or time. It can be useful to remember something like their birth date or when something was made.

Example:

json

CopyEdit

{

"event_name": "School Science Fair",

 "event_date": ISODate("2024-11-15T10:00:00Z"),

 "event_duration_hours": 3

}

The field event_date uses the ISODate function so that it captures the specific date and time.                       

8. Timestamp

A timestamp saves the exact moment an action happened. An action can be a file being created or changed.

Example:

json

CopyEdit

{

 "blog_title": "Healthy Eating Tips",

 "blog_author": "Arjun Mehta",

 "blog_created": Timestamp(1627891234, 1)

}

The blog_created field returned the exact moment this blog essay was created.

 

 How to obtain MongoDB  certification? 

We are an Education Technology company providing certification training courses to accelerate careers of working professionals worldwide. We impart training through instructor-led classroom workshops, instructor-led live virtual training sessions, and self-paced e-learning courses.

We have successfully conducted training sessions in 108 countries across the globe and enabled thousands of working professionals to enhance the scope of their careers.

Our enterprise training portfolio includes in-demand and globally recognized certification training courses in Project Management, Quality Management, Business Analysis, IT Service Management, Agile and Scrum, Cyber Security, Data Science, and Emerging Technologies. Download our Enterprise Training Catalog from https://www.icertglobal.com/corporate-training-for-enterprises.php and https://www.icertglobal.com/index.php

Popular Courses include:

  • Project Management: PMP, CAPM ,PMI RMP

  • Quality Management: Six Sigma Black Belt ,Lean Six Sigma Green Belt, Lean Management, Minitab,CMMI

  • Business Analysis: CBAP, CCBA, ECBA

  • Agile Training: PMI-ACP , CSM , CSPO

  • Scrum Training: CSM

  • DevOps

  • Program Management: PgMP

  • Cloud Technology: Exin Cloud Computing

  • Citrix Client Adminisration: Citrix Cloud Administration

The 10 top-paying certifications to target in 2025 are:

Conclusion:

MongoDB is a special kind of database that stores different types of information. It can save words, numbers, true/false answers, dates, lists, and even pictures. Each type of data has its own use, like strings for text, integers for whole numbers, and booleans for yes or no. MongoDB helps keep data organized and easy to find. Because it supports many types of data, it works fast and well even with large amounts of information. Learning about these data types helps us understand how MongoDB stores and uses data in smart and useful ways.

Contact Us For More Information:

Visit :www.icertglobal.com Email : info@icertglobal.com

iCertGlobal InstagramiCertGlobal YoutubeiCertGlobal linkediniCertGlobal facebook iconiCertGlobal twitter

 



Comments (0)


Write a Comment

Your email address will not be published. Required fields are marked (*)



Subscribe to our YouTube channel
Follow us on Instagram
top-10-highest-paying-certifications-to-target-in-2020





Disclaimer

  • "PMI®", "PMBOK®", "PMP®", "CAPM®" and "PMI-ACP®" are registered marks of the Project Management Institute, Inc.
  • "CSM", "CST" are Registered Trade Marks of The Scrum Alliance, USA.
  • COBIT® is a trademark of ISACA® registered in the United States and other countries.
  • CBAP® and IIBA® are registered trademarks of International Institute of Business Analysis™.

We Accept

We Accept

Follow Us

iCertGlobal facebook icon
iCertGlobal twitter
iCertGlobal linkedin

iCertGlobal Instagram
iCertGlobal twitter
iCertGlobal Youtube

Quick Enquiry Form

watsapp WhatsApp Us  /      +1 (713)-287-1187