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.
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.
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.
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.
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.
https://github.com/louischatriot/nedb
https://github.com/louischatriot/nedb
https://github.com/louischatriot/nedb/wiki
Louis Chatriot
2013
2017