Sunday, April 22, 2012

MongoDB Schema Design tips

http://www.mongodb.org/display/DOCS/Schema+Design

As we design the schema, the questions we must answer are:
  1. When do we embed data versus linking (see below)? Our decisions here imply the answer to question #2:
  2. How many collections do we have, and what are they?
  3. When do we need atomic operations? These operations can be performed within the scope of a BSON document, but not across documents.
  4. What indexes will we create to make query and updates fast?
  5. How will we shard? What is the shard key?