https://education.10gen.com/
Notes from M101J - week3:
Cool stuff about MongoDB schema
- Rich documents
- Store array of data
- Pre-join data (embed data)
- Fast access
- No "Mongo Joins"
- No constraints
- No primary key / foreign key
- Atomic
transactionoperation - Within one document
- No declared schema
- Similar structure in documents
Living without transactions
- Atomic operation
- In order to accomplish it:
- restructure code to work within same document.
- Implement locking mechanism / semaphore
- Tolerate inconsistency
- One to one relationship
- Embed or not to embed depends on:
- Freq of access
- sSize of items ( > 16MB? )
- Atomicity of data
- Benefits of embedding
- Improved read performance
- One round trip to DB
- High latency: 1ms
- High bandwidth
- "Write" latency can be sig. improved by embedding data
- Decision to denormalize
- 1:1 - Embed
- 1: many - Embed (from many to 1)
- many : many - Link (using array of _id)
No comments:
Post a Comment