This can without doubt be considered a stupid question, and that we can all laugh about how exactly stupid it's once the answer highlights the glaring simplicity from it all, when you are firmly indoctrinated in the skill of relational databases I can not appear to obtain my mind entirely around mongodb - regardless of the number of articles I just read or videos I watch.

Here's my situation. I've got a project which potentially may have countless customers. Core features:

  • Have a listing of customers of four different kinds
  • One sort of these customers can make occasions
  • Other user types can use to become perform in the event (there's a request system between your using party and arranging party to concur terms)
  • Other user types can attend the big event
  • All user types can stick to the event
  • Every user can upload an limitless quantity of images for their "gallery"

Now I'd instantly know how to pull off normalising a MySQL database and joining queries to find the data I require, but how about mongodb?

Since all this details are relational towards the customers will i just produce a single collection for customers? For every user will i produce a document? Performs this document store all particulars of occasions, demands and pictures relevent to that particular user - or simply some kind of id of these stuff that Then i mix reference? Otherwise wouldn't this replicate lots of data - i.e. basically needed to replicate all event data for each user following/attending/carrying out at this event and set it for the reason that customers document (I am sure this is not the situation - but without joins how do you get "join" the consumer and all sorts of event data if occasions are saved in another collection?). How about images? A customers document could be 16mb - but when I allow limitless images and everything associated with the consumer was saved in one document then your images alone could grow bigger than the usual single document?

I am certain I am lacking the knowledge of pretty vital to understanding mongodb - enlighten me!

Thanks.

You should use 2 different User &lifier Event collection to create your application. Something similar to this

UserDocument Collection
    -Type
    -Details    

EventDocument Collection
    -Created By
    -EventDetail
    -AppliedUsers
         -"User A",User B"
    -AttendingUsers
         -"User C",User D"
    -FollowingUsers
         -"User E",User F"

Event documet got all of the userid's of applied, attending &lifier following customers using Dbref.

Yet another approach is store frequently utilized user document fields together with the DBref objects. This eliminates the unwanted hits towards the db and storing redundant (complete user data) data within the document. something similar to

 EventDocument Collection
    -Created By
    -EventDetail
    -AppliedUsers
         -"User"
             - Name
             - XXX
             - DbRef to User A
    -AttendingUsers
         -"User"
             - Name
             - XXX
             - DbRef to User B

    -FollowingUsers
         -"User"
             - Name
             - XXX
             - DbRef to User C

         -"User"
             - Name
             - XXX
             - DbRef to User D

For images you should use GridFs. This can split the big files directly into more compact portions.

Cheers