Loading Depth Study
Preparing your workspace
MongoDB stores documents in collections and uses BSON, a binary representation of JSON-like data, for storage and transport.
A MongoDB document is made of fields and values. Documents are stored inside collections, which are conceptually similar to tables but are more flexible. MongoDB uses BSON instead of plain JSON internally because BSON supports additional data types and efficient binary encoding. Every document normally has a unique _id field. The flexible document model allows nested objects and arrays, making complex application data easier to represent.
A users collection may contain documents where each user has an ID, name, email, preferences, and other structured fields.
const user = {
_id: "u101",
name: "Aman",
email: "aman@example.com",
preferences: {
theme: "dark"
},
skills: ["HTML", "CSS", "JavaScript"]
};
console.log(user._id);The example shows a document with an ID, nested preferences, and an array of skills.