API Reference

@seald-io/nedb

Embedded persistent datastore for Node.js with a MongoDB-like API and an append-only storage format.

Official Documentation ↗
CompatibilityThis documentation covers version v4. Check the official docs for the latest API surface.

Installation

npmnpm install @seald-io/nedb

Methods

nedb keeps documents in memory with an append-only on-disk log that is compacted automatically.

Key Features

  • Mongo-like find, insert, update, remove
  • Indexed fields for fast lookups
  • Append-only persistence with auto compaction

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/seald/nedb@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:51:04.754Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

FAQ

How does nedb differ from SQLite?
nedb is a document store with a Mongo-style API and no schema, while SQLite is a relational engine with SQL and transactions.
Why is my file growing?
Writes append to the log and compaction only runs on load or when triggered. Call db.compactDatafile() periodically in write-heavy apps.
Which fields should I index?
Any field used in frequent queries. Call db.ensureIndex({ fieldName: "email" }) once at startup to avoid full scans.