Skip to content

Commit

Permalink
added a note on just how powerful embedded documents can be
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl Seguin authored and Robert Duncan committed Mar 29, 2011
1 parent f6fc6b5 commit f53a1a6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions en/mongodb.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ First, you should know that an individual document is currently limited to 4 meg

db.users.insert({name: 'leto', email: 'leto@dune.gov', account: {allowed_gholas: 5, spice_ration: 10}})

That doesn't mean you should underestimate the power of embedded documents or write them off as something of minor utility. Having your data model map directly to your objects makes things a lot simpler and often does remove the need to join. This is especially true when you consider that MongoDB lets you query and index fields of an embedded document.

### Few or Many Collections ###
Given that collections don't enforce any schema, it's entirely possible to build a system using a single collection with a mismatch of documents. From what I've seen, most MongoDB systems are laid out similarly to what you'd find in a relational system. In other words, if it would be a table in a relational database, it'll likely be a collection in MongoDB (many-to-many join tables being an important exception).

Expand Down

0 comments on commit f53a1a6

Please sign in to comment.