Question 14 / 50
You stored comments as an array on each post. The write path starts failing for popular posts. What happened, and what would you change?
Short answer
The comments array grew without bound. Documents cap at 16MB, and long before that every read and rewrite of the post pays for the whole array. Move comments to their own collection, keyed by postId, or bucket them into fixed-size documents.
Why?
Embedding is correct for a bounded, always-read-together child. Comments on a popular post are unbounded and independently paginated. Indexing the array also creates one index entry per comment. The bucket pattern — N comments per document — is the usual middle ground for high-volume append-only data.
Interview tip
Name the 16MB limit, then say the real pain starts earlier: rewrite cost and over-fetching.
Common mistake
Only mentioning 16MB. Interviewers also want the access-pattern reason to split.
How did you do?
Cheat Sheet