Hi all :)
Let's say I have a app called "Opposites Attract". And in it I have a
User model, and each user has a list of
Likes and a list of
Dislikes.
Each USER can have a maximum of:
- 200 Likes.
- 200 Dislikes.
I want to query this information to find out for a given
Like, what other users
Dislike it or vice versa. I don't need to return EVERY person that likes or dislikes a particular
thing. If I just returned the first 100 people found to like/dislike a particular thing, that would be
acceptable.
How would it be best to model this?Here (
http://code.google.com/appengine/articles/modeling.html) it speaks of a potentially similar example under the
Many to Many example, and if I were to implement it in this way, I would have a class like so:
class User(db.Model):
likes = db.ListProperty(db.Key)
dislikes = db.ListProperty(db.Key)
where the keys in both lists would refer to items from a
Thing model.
What I'm wondering is in the App Engine Documentation's example they mention:
"In the example above, the Contact side was chosen because a single person is not likely to belong to too many groups, whereas in a large contacts database, a group might contain hundreds of members."
With that quote in mind, does this method suit my example? I want to design this app so that hundreds of thousands of people can like or dislike a thing. So I would feel better if the above quote read "whereas in a large contacts database, a group might contain hundreds (OF THOUSANDS) of members."
Also though I expect this doesn't change how I model this particular relationship I feel I should mention this in case it does:
While my concern at the moment is searching ALL users that like or dislike a particular thing, my next step would be to search by
Gender and
Location For example:
"all GIRLS who likes Dogs"
"everyone in Los Angeles who dislikes Cats"