Hint: Query embedded fields with dot notation [OK]
Common Mistakes:
Assuming query matches documents without 'Book'
Expecting syntax error from dot notation
Confusing array matching with string matching
4. You have a user document with an embedded array of comments. You try to update a comment's text but the update does not work. Which is the likely error?
D. Missing $ positional operator to target the correct array element
Solution
Step 1: Analyze update query
The filter matches the comment with id 5, but the update sets 'comments.text' without specifying which array element.
Step 2: Identify missing positional operator
To update a specific array element, the $ positional operator is needed in the update path: 'comments.$.text'.
Final Answer:
Missing $ positional operator to target the correct array element -> Option D
Quick Check:
Use $ to update matched array element [OK]
Hint: Use $ to update specific array item [OK]
Common Mistakes:
Forgetting $ in update path for arrays
Changing updateOne to updateMany unnecessarily
Assuming collection name or filter syntax is wrong
5. You want to model a blog app where each post has many comments. Comments can be very large and users often read posts without comments. Which modeling choice is best and why?
hard
A. Embed comments inside posts to get all data in one query
B. Store comments in a separate collection and reference posts to avoid large post documents
C. Store comments as strings inside posts to save space
D. Duplicate comments in both posts and a separate collection
Solution
Step 1: Analyze data size and access pattern
Comments are large and often not needed when reading posts, so embedding would make posts heavy.
Step 2: Choose referencing for efficiency
Referencing comments separately keeps post documents small and loads comments only when needed.
Final Answer:
Store comments in a separate collection and reference posts to avoid large post documents -> Option B
Quick Check:
Large optional data = use referencing [OK]
Hint: Large optional data? Use referencing [OK]
Common Mistakes:
Embedding large optional data causing slow reads
Storing comments as strings losing structure
Duplicating data causing inconsistency
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.