Note that there are some explanatory texts on larger screens.

plurals
  1. POBasic mongodb theory
    text
    copied!<p>This will no doubt be a stupid question, and we can all laugh about how stupid it is when the answer points out the glaring simplicity of it all, but being firmly indoctrinated in the art of relational databases I can't seem to get my head entirely around mongodb - no matter how many articles I read or videos I watch.</p> <p>Here's my situation. I have a project which potentially will have millions of users. Core features:</p> <ul> <li>Have a list of users of 4 different types</li> <li>One type of these users can create events</li> <li>Other user types can apply to be perform at the event (there is then a request system between the applying party and organising party to agree upon terms)</li> <li>Other user types can attend the event</li> <li>All user types can follow the event</li> <li>Every user can upload an unlimited amount of images to their "gallery"</li> </ul> <p>Now I would instantly know how to go about normalising a MySQL database and joining queries to get the data I require, but what about mongodb?</p> <p>Since all of this information is relational to the users do I just create a single collection for users? For each user do I create a document? Does this document store all details of events, requests and images relevent to that user - or just some sort of id for these things that I then cross reference? If not wouldn't this replicate a lot of data - i.e. if I had to replicate all event data for every user following/attending/performing at that event and put it in that users document (I'm sure this isn't the case - but without joins how do I get "join" the user and all event data if events are stored in another collection?). What about images? A users document can be 16mb - but if I allow unlimited images and everything related to the user was stored in a single document then the images alone could grow larger than a single document?</p> <p>I'm sure that I'm not understanding pretty vital to understanding mongodb - enlighten me!</p> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload