Pick the fix
A blog post can receive 50,000 comments. How do you store them?
Hint 1 of 1
Is the list bounded?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Comments in their own collection referencing the post id, maybe embedding the latest few
Correct. Unbounded growth belongs outside the parent.
Embed what is bounded and read with the parent. Comments grow without limit, so they get their own collection keyed by post id, and the post can keep a few recent ones for fast display.
Why not the others?
- B Embed all comments in the post document. Hits the 16 MB limit and makes every post read heavy.
- C One document per post with comments as a single string. Unqueryable.
- D Put comments in Redis only. Not durable.