I'm using MongoDB. I have Users and I have Things. A user can follow or like those things and he can also follow another user. Where should I store the list of likes and follows? In SQL that was a JOIN call with a table of following / type / followed, but in Mongo, well... I just don't know.
Options I think of:
A collection with following / type / followed, each has a DBref
Storing the data twice, once in the users collection and once in the things collection. The maintainability of this looks bad and so does 开发者_开发百科querying.
I would suggest option 1 since you might need to do some computation. Map reduce works only on one collection for now. It's also easier to provide stats. I don't really use DBref but this approach has owrked pretty well so far for me.
精彩评论