I would like to ask the community what your best-practice approaches for denormalizing data in Meteor are.
Just a sample: In many social apps, you would have your users directly linked to target objects, like posts or comments. So if you are displaying a post, you would typically display the corresponding user’s name as well. For performance reasons, in such 1:n relationships it would be better to store the username directly in the post’s document, to save an additional round-trip to the users collection. AFAIR, this is also the proposed way mentioned in Mongo’s data modelling documentation.
However, this also means that you would have to update each and every collection once the user changes the username. This wouldn’t concern me if Mongo had a concept like transactions, but because it does not, this would (at least potentially) induce the risk of corrupt data, which could be avoided by storing the user ids instead and something like
reywood:publish-composite to publish joins instead. And I do not have any clues about how Mongo actually performs if you have to update lots of data in several collections. Or more generally speaking, how Mongo performs if collections grow larger, which is quite likely if you store lots of data denormalized and yet have a lot of redundancy in the data-model.
So, is there any
best-practice discussion / tutorial / blog out there explaining good strategies for denormalization esp. in combination with Meteor? I’ve already read the recommendations of the MongoDB documentation, but did not find good Meteor-related recommendations so far.