Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If You need to query on your Users, keep users alone. If You need to query on your uploads, keep uploads alone.</p> <p>Another question you should ask yourself is: Every time i need this data, do I need the embedded objects (and vice-versa)? How many time this data will be updated? How many times this data will be read?</p> <p><strong>Think about a friendship request:</strong> Each time you need the request you need the user which made the request, then embed the request inside the user document.</p> <p>You will be able to create an index on the embedded object too, and your search will be mono query / fast / consistent.</p> <hr> <p><em>Just a link to my previous reply on a similar question:</em> <a href="https://stackoverflow.com/questions/3128200/mongo-db-relations-between-objects/7287321#7287321">Mongo DB relations between objects</a></p> <p>I think this post will be right for you <a href="http://www.mongodb.org/display/DOCS/Schema+Design" rel="nofollow noreferrer">http://www.mongodb.org/display/DOCS/Schema+Design</a></p> <p><strong>Use Cases</strong></p> <p><em>Customer / Order / Order Line-Item</em></p> <blockquote> <p>Orders should be a collection. customers a collection. line-items should be an array of line-items embedded in the order object.</p> </blockquote> <p><em>Blogging system.</em></p> <blockquote> <p>Posts should be a collection. post author might be a separate collection, or simply a field within posts if only an email address. comments should be embedded objects within a post for performance.</p> </blockquote> <p><strong>Schema Design Basics</strong></p> <p><em>Kyle Banker, 10gen</em></p> <blockquote> <p><a href="http://www.10gen.com/presentation/mongosf2011/schemabasics" rel="nofollow noreferrer">http://www.10gen.com/presentation/mongosf2011/schemabasics</a></p> </blockquote> <p><em>Indexing &amp; Query Optimization Alvin Richards, Senior Director of Enterprise Engineering</em></p> <blockquote> <p><a href="http://www.10gen.com/presentation/mongosf-2011/mongodb-indexing-query-optimization" rel="nofollow noreferrer">http://www.10gen.com/presentation/mongosf-2011/mongodb-indexing-query-optimization</a></p> </blockquote> <p>**These 2 videos are the bests on mongoddb ever seen imho*</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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