Skip to content

NoSQL

一句话解释

NoSQL 数据库存储数据不使用 fixed 表 Schema — as documents, 键-值 pairs, wide 列, or 图 — prioritizing flexibility and horizontal scale.

用大白话说

NoSQL ("不仅 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.

示例

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

MongoDB document 能有 任何字段 — 否需要到 定义列 前方的 时间.

常见混淆

  • 容易混淆的对象: relational 数据库

    关键区别: NoSQL 数据库做 不 use 表使用 fixed Schema or SQL; 它们存储 flexible documents, 键-值 pairs, or 图. Relational 数据库 enforce 结构 and use SQL.

相关术语

相关资源

相关课程

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表