hi all, I'm working on a proof of concept app for a twitter style
social network with about 500k users. I'm unsure of how best to
design the 'schema'
should I embed a user's subscriptions or have a separate
'subscriptions' collection and user db references? If I embed, I
still have to perform a query to get all of a user's followers. e.g.
Given the following user:
{
"username" : "alan",
"photo": "123.jpg",
"subscriptions" : [
{"username" : "john", "status" : "accepted"},
{"username" : "paul", "status" : "pending"}
]
}
to find all of alan's subscribers, I'd have to run something like
this:
db.users.find({'subscriptions.username' : 'alan'});
from a performance point of view, is that any worse or better than
having a separate subscriptions collection?
also, when displaying a list of subscriptions/subscribers, I am
currently having problems with n+1 because the subscription document
tells me the username of the target user but not other attributes I
may need such as the profile photo. Are there any recommended
practices for such situations?
thanks
Alan
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to
mongod...@googlegroups.com.
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/mongodb-user?hl=en.