Skip to content

NoSQL Data Modeling

Database

Design data models for NoSQL: document, key-value, column-family, graph.

Official Site
01

Overview

NoSQL types: Document (MongoDB), Key-value (Redis), Column-family (Cassandra), Graph (Neo4j). Model for access patterns. Denormalize for reads. Embed for 1-few, reference for 1-many. No joins.

bash
// MongoDB: embed
db.users.insert({name:"Alice",addr:["NYC"]});
// Redis: key-value
SET user:1:name "Alice"
// Cassandra: query-first
CREATE TABLE t (uid INT, oid UUID, PRIMARY KEY(uid,oid));
02

Best Practices

Model for access patterns (query-first). Embed for 1-few. Reference for 1-many. Denormalize for read perf. Use aggregations instead of joins. Design partition keys for even distribution. Consider CAP tradeoffs.

Ready to try NoSQL Data Modeling?

Visit the official site for the latest version and full documentation.

Visit NoSQL Data Modeling