Stage 1 · Lesson 3 of 8
BSON and data types
MongoDB does not store plain JSON. It stores , a binary form of JSON with more types: 32-bit and 64-bit integers, , for exact decimals, dates, and binary data. JSON has only one number type and no date type, so the extra types matter.
Money belongs in Decimal128, not a double, which cannot hold 0.10 exactly. Timestamps belong in the Date type, not in strings, so they sort and compare correctly. In (the MongoDB shell), a bare number like 5 is stored as a double, so use NumberInt, NumberLong or NumberDecimal when the type matters.
Queries match on type as well as value in some cases, which you will meet in the next stage.
Common trapstoring dates as strings like "12/03/2026", which sort alphabetically and break every range query.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with
- CourseFreeMongoDB University
MongoDB
Free: start with the introduction to MongoDB and Atlas setup lessons, which use the same sample data
Practise
Keep handy
Also worth your time
A balanced comparison of where a document database fits and where a relational one wins