Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You should follow the suggestions that@Bugai13 and @Ramesh Vel suggested regarding the design of your DB, images and DBRefs. I just wanted to clarify a couple of things.</p> <blockquote> <p>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</p> </blockquote> <p>People came up with normalisation in relational databases at a time when storage was expensive - hence splitting data in multiple data and reconstructing them using joins. Now that storage is relatively very cheap, if you need performance, having repetition of data is not frowned upon at all. It does depend on the application, however, your query pattern, the amount of data you're storing and speed of reads/writes you're after. But, you'll say, won't more writes (since no normalisation) lead to worse performance? Not necessarily, depends on the app. If you're worried about this, look at sharding (for MongoDB: <a href="http://www.mongodb.org/display/DOCS/Sharding+Introduction" rel="nofollow">http://www.mongodb.org/display/DOCS/Sharding+Introduction</a>). </p> <blockquote> <p>but without joins how do I get "join" the user and all event data if events are stored in another collection?</p> </blockquote> <p>Also note that, as far as I understand (happy to be corrected on this), there isn't a 'join' operation in MongoDB. This happends on just some drivers. As the docs say here :</p> <blockquote> <p>DBRef's have the advantage of allowing optional automatic client-side dereferencing with some drivers</p> </blockquote> <p>Notice that dereferencing happens client-side only, and it happens only for 'some' drivers. As far as I gather, PHP does but the Java driver doesn't - you would have to handle the join at the application level by fetching the two result sets from the separate collections and join them by hand, despite the DBRef. </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