I am trying to create an event platform using MongoDB as db. I want a many-to-many relationship between Events and Users . The fact is that I want the relationship to have properties (for example, Users can be confirmed or not confirmed for a specific Event ). I understand that this is ideal for RDBMSs, but I use MongoDB for reasons that I use elsewhere, and I would prefer to continue to use it.
I would like each Event insert many Guests owned by Users . Thus, I can see which users are attending the event quickly and with only one request. However, I would also like to see which Events a User attends quickly, so I would like each User have an array of Event ids.
Here is a summary of the code.
With an ideal usage pattern, e has a Guest with a link to u , and u has a link to e .
I know that the has_many :through line will not work. Any suggestions on how to get similar functionality? I was thinking of using the after_create in Guest to add a link to the Event in User , but that seems pretty hacky.
Perhaps I went the wrong way. Suggestions? Thanks.
source share