Hacker News new | ask | show | jobs
by contrahax 4519 days ago
Why not use backwards document references? Put the post id on each comment and query like Comments.find({post: post._id}, {limit: 30}) to get 30 comments. Why would you store all of the comments for a Post on the post itself?
2 comments

That's exactly what we're doing (apart from the denormalization approach, which we don't really recommend). The problem is doing this in a way that A) is reactive (i.e. updates in real time) and B) efficient.
Because those comments will only ever be relevant to that one post, so adding an extra lookup every time you're concerned with the comments is considered bad

At least that's how I understand the philosophy.