Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases Mongo Basics Getting Started With MongoDB Review: Documents

What are Mongo Field types?

How many types of Field Types are there in Mongo?

1 Answer

Priyajot Syan
PLUS
Priyajot Syan
Courses Plus Student 2,643 Points

Mongo data types are of BSON format. As of version 4.0 there are 21 bson types out of which 3 have been deprecated Commonly used are: 1.) ObjectId - 12 byte unique ID 2.) Double - to store float 3.) Integer - to store integers 4.) Date - to store date or time 5.) Timestamp - to store unique timestamps in seconds 6.) Null - to store null values 7.) Boolean - to store true/false 8.) Object - for adding documents in documents (Embedded Documents) 9.) String - for storing String values 10.) Array - to store arrays