Document databases store data in flexible, easy-to-understand formats. They let you work with data that changes often or has many parts without strict rules.
When your data has many different fields that can change over time.
When you want to store related information together in one place, like a user and their orders.
When you need to build apps quickly without designing complex tables.
When your data structure is not fixed and can vary between records.
When you want to scale your database easily across many servers.
MongoDB uses special operators like $gt for 'greater than' inside query objects.
Step 2: Correct the query syntax
The correct query is {age: {$gt: 25}}, not using > directly.
Final Answer:
The operator > should be inside $gt like {age: {$gt: 25}}. -> Option D
Quick Check:
Use $gt for greater than in MongoDB queries [OK]
Hint: Use $gt, $lt for comparisons, not > or < directly [OK]
Common Mistakes:
Using > directly in query object
Mixing SQL syntax with MongoDB
Assuming >= fixes the error
5. You have a blog application storing posts and comments. Why is a document database better than a relational one for storing posts with many comments?
hard
A. Because relational databases cannot store comments at all.
B. Because you can store each post and its comments together in one document, making reads faster.
C. Because document databases require all comments to be in separate collections.
D. Because relational databases do not support indexing on comments.
Solution
Step 1: Understand data embedding in document databases
Document databases allow embedding related data (like comments) inside a single document (post).
Step 2: Compare with relational approach
Relational databases store posts and comments in separate tables, requiring joins to combine them.
Step 3: Benefits of embedding
Embedding comments inside posts reduces the need for joins and speeds up reading a post with its comments.
Final Answer:
Because you can store each post and its comments together in one document, making reads faster. -> Option B
Quick Check:
Embedding related data = faster reads [OK]
Hint: Embed related data in one document for faster access [OK]
Common Mistakes:
Thinking relational DBs can't store comments
Believing comments must be separate collections
Assuming relational DBs lack indexing
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.