News for hackers. Stuff that matters.
Re:3 reasons to use MongoDB by weixiyen on Thursday September 09, 2010 @02:17PM (#1676273)
Use 2 collections (tables).

Users

- id

- events_attended (array of event ids)

Events

- id

- users_attended (array of user ids)

If you want to get events a user attended, do a query like:

1) get the user.events_attended array

2) events.find({_id:{$in: [user.events_attended] }})

3) now you have a nice json object of all events the user has been to

If you want to get all users that went to an event:

1) get the event.users_attended array

2) users.find({_id:{$in: [event.users_attended] }});

3) now you have a nice json object of all users who attended and event

Re:3 reasons to use MongoDB by binomial on Thursday September 09, 2010 @05:40PM (#1677045)
i.e. do it like you would in a relational database.