The Document Model Flashcards
(11 cards)
What is a Document?
Single record in MongoDB
Stored as a JSON-like BSON object
Represents a flexible, self contained unit of data
What is BSON?
Binary JSON, the format used by MongoDB to store and query documents, supporting rich data types like arrays, dates, and embedded objects
What is a Collection?
Similar to a Table in a Relational Database, without a fixed schema
It’s a group of MongoDB Documents
What is a Embedded Document
A document nested within another document, allowing hierarchial data storage (e.g. an “addres” document inside a “user” document
Schema Flexibility
The ability of mongodb documents to have varying structures within the same collection, enabling dynamic and evolving data models
Why is the Document Model “Easy”
Aligns with how developers thing about data in application (e.g. JSON-like structures),
Intuitive Data Modeling
Reduces the learning curve
Simplifying development
Why is the Document Model “Flexible”
Collections can store documents with different fields
This allows the data model to evolve without rigid constraints
Why is the Document Model “Faster”
Denormalization - storing related data together eliminates need for expensive joins, speeding up queries
Data locality - embedding related data in a single document reduces disk I/o, improving retrieval performance
Query expressiveness; aggregation framework and indexing optimize complex queries, ensuring fast data access
Why is the Document Model “Versatile”
*Rich data types, BSON supports arrays, embedded docuemnts, geospatial data, and more, accommodating diverse use-cases like IoT, real time analytics, and content management.
What are the Benefits of the Document Model
Easy, Flexible, Faster, Versatile
Document Model Core Capabilities
Superior Architecture - Aligns with how developers thing about data in application (e.g. JSON-like structures),
Faster Innovation - with data normalization, data locality, and query expressiveness, you can build faster without costly schema changes
Flexible Deployment - run self hosted, in the cloud, or hybrid.
Reduced Complexity - customers don’t need to stitch together different solutions.
Enterprise Security - there’s encryption at ever stage (in transit, at rest, and in-use) - with Queryable encryption, you can encrypt your sensitive data and run queries directly on it , without having to decrypt it.