Skip to content

NoSQL

In one line

NoSQL databases store data without a fixed table schema — as documents, key-value pairs, wide columns, or graphs — prioritizing flexibility and horizontal scale.

In simple words

NoSQL ("Not Only SQL") databases trade the strict table schema of relational databases for flexibility. Instead of rows and columns, they store data in other shapes:

  • Document stores (MongoDB, CouchDB): each record is a JSON-like document with any fields.
  • Key-value stores (Redis, DynamoDB): each record is a key pointing to a value.
  • Wide-column stores (Cassandra, HBase): data is stored in column families, not rows.
  • Graph databases (Neo4j): data is stored as nodes and edges.

NoSQL databases are often chosen when the data shape changes rapidly, when you need massive horizontal scale, or when you do not need complex joins. The trade-off is that you lose some of the consistency guarantees and query power of relational databases.

Example

javascript
// A MongoDB document — flexible, no fixed schema
const user = {
  name: "Ada Lovelace",
  email: "ada@example.com",
  skills: ["math", "programming"],
  meta: { joined: "1843-01-01", verified: true }
};

A MongoDB document can have any fields — no need to define columns ahead of time.

Common confusions

  • Confused with: relational database

    The difference: NoSQL databases do not use tables with a fixed schema or SQL; they store flexible documents, key-value pairs, or graphs. Relational databases enforce structure and use SQL.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary