3 ms·
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 w
by contrahax 13y 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?
- hayksaakian 13y agoBecause 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.
- sgdesign 13y agoThat'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.