BSON Documents & Collections
MongoDB stores data records as BSON documents. BSON is a binary serialization of JSON that contains additional data types like ObjectId, Date, and Binary data.
1 Document Structure Example
JSON — Sample Document
{
"_id": ObjectId("507f1f77bcf86cd799439011"),
"username": "balaji",
"email": "balaji@test.com",
"age": 25,
"hobbies": ["coding", "reading"],
"address": {
"city": "Hyderabad",
"country": "India"
},
"created_at": ISODate("2026-07-13T10:00:00Z")
}
2 Code Challenge
Challenge: Write a custom JSON document representing an e-commerce product. Include nested properties for product dimensions (width, height, depth) and an array of tags.