NeDB is a lightweight embedded document DBMS written in JavaScript. It supports Node.js, nw.js, Electron, and web browser environments. It is designed to be partially compatible with MongoDB's JSON-based query API. NeDB is useful for storing small amounts of data in memory. When the amount of data exceeds the bounds of what NeDB can hold effectively, switching to MongoDB is intended to be straightforward because it uses the same API.[03][01][04]
- Source Code
- https://github.com/louischatriot/nedb[01]
- Developer
- Country of Origin
- FR
- Start Year
- 2013 [15]
- End Year
- 2017 [05]
- Project Type
- Open Source
- Written in
- JavaScript
- Supported Languages
- JavaScript
- Inspired By
- Redis
- Compatible With
- MongoDB
- License
- MIT License
NeDB is a lightweight embedded document DBMS written in JavaScript. It supports Node.js, nw.js, Electron, and web browser environments. It is designed to be partially compatible with MongoDB's JSON-based query API. NeDB is useful for storing small amounts of data in memory. When the amount of data exceeds the bounds of what NeDB can hold effectively, switching to MongoDB is intended to be straightforward because it uses the same API.[03][01][04]
History[05]
In May 2013, Louis Chatriot began developing a lightweight embeddable and in memory database system that used a subset of the MongoDB API. It was completed in 2017 and now is on GitHub where individuals can contribute to the project by fixing several bugs but no additional features are being implemented currently. However, several separate teams have forked copies of the original NeDB database and began implementing their own ideas and additional features that weren't originally intended by the original creator.
Concurrency Control[06]
NeDB is written completely in Javascript and since Javascript is inherently single-threaded, there is no concurrency in the system. Additionally, each process receives its own copy of the database, which means it can't sync the views that two different processes have of the data.
Indexes[07][08][09]
NeDB supports indexing and helps provide a sufficient speed boost. It allows for indexing of any field, including those in nested documents. An index can be created at any point, even after data has been inserted. However, it is most efficient if done when the application is started because the index is created synchronously. The time to create an index is quite fast so it doesn't impact startup time too much. Additionally, indexes allow for the database to perform fast reads and writes.
Isolation Levels
NeDB does not support any isolation levels because no concurrency is guaranteed by the system.
Joins[10][11]
Although MongoDB does support joins, NeDB does not because the only similarites between NeDB and MongoDB are the syntax for queries used in the API. Additionally, NeDB does not support joins because it is not a relational database but rather a document store database.
Logging[04]
NeDB does not support logging because all data is stored in memory. However, a NeDB logger has been created that can be used to insert documents into a NeDB-readable database.
Query Execution[12]
All query requests will be exceeds in the order that they came in. If the executor is ready, then the task will be queued, but if the executor is idle the task will be processed immediately. All tasks are executed sequentially.
Query Interface[13]
The JavaScript API is a subset of MongoDB. The syntax for the query commands are the same as MongoDB, which allows for easy mitigation to MongoDB once the amount of data becomes too large for NeDB.
Storage Architecture[14]
NeDB stores all databases in memory in order to perform fast find and query operations. Storing all the data in memory causes NeDB to only perform well on smaller datasets.
Storage Organization[01]
NeDB uses an append-only format, which means all updates and deletes will be added to the end of the datafile. This is done for performance reasons. The database is automatically compacted whenever it is loaded within an application. It is possible to run manual compaction, but it requires everything else to be paused and can take some time to complete. Therefore, most applications don't need to do this.
System Architecture[01]
NeDB uses an embedded database system approach. The database system is on the application when it is being run because it is imported to the application as a library. Additionally, the system is used through API calls, which are the same as MongoDB.
Citations
15 sources- GitHub - louischatriot/nedb: The JavaScript Database, for Node.js, nw.js, electron and the browser · GitHub github.com
- Home · louischatriot/nedb Wiki · GitHub github.com
- NeDB: A Lightweight JavaScript Database stackabuse.com
- https://www.npmjs.com/package/nedb npmjs.com
- Is this still maintained? · Issue #492 · louischatriot/nedb github.com
- Multiple node processes support with a single datastore file · Issue #105 · louischatriot/nedb github.com
- Indexing · louischatriot/nedb Wiki · GitHub github.com
- Server-side JavaScript - Database Manual - MongoDB Docs mongodb.com
- nedb/lib/indexes.js at master · louischatriot/nedb · GitHub github.com
- Documentation: Join/Merge · Issue #541 · louischatriot/nedb github.com
- NeDB, a pure Javascript database for Node.js and Node Webkit | Hacker News ycombinator.com
- nedb/lib/executor.js at master · louischatriot/nedb · GitHub github.com
- http://10minbasics.com/nedb-basics 10minbasics.com
- Memory footprint · Issue #144 · louischatriot/nedb github.com
- Initial commit github.com