CS186-L20: NoSQL
Contents
Scaling Relational Databases isn’t always the best option
including partitioning and replication
BUT, consistency is hard to enforce!
Taxonomy of NoSQL Data Models
Key-Value Stores
|
|
Distribution / Partitioning, just using hash function
- if no replication, key k is stored on $h(k)$ node
- if multi-way replication, key k is stored on $h_i(k), i=1,2,…,n$ nodes
Extensible Record Stores
the idea is that do not use a simple key to lookup 🤔
Document Stores
JSON Documents
using JSON as example
do not store replicated key!
JSON is a Tree 🪵, Self-describing 💬, and Flexible 🔥
can store Json in RDBMS
|
|
mapping between JSON and Relational Data
Relational Data Model ===> JSON Document easy, note that replicated key can be handled by using a array [ ]
JSON Document ===> Relational Data Model
- using NULL to represent missing values
- nested or replicated data? hard to handle! multi-tables may help 🤔
Introduction to MongoDB
基本语法
select and find
|
|
Limit and sort
MQL Aggregations and Updates
unwind
update