This is a guest post by Louis Chatriot
Sometimes you need database functionality but want to avoid the constraints that come with installing a full-blown solution. Maybe you are writing a Node service or web application that needs to be easily packageable, such as a continuous integration server. Maybe you’re writing a desktop application with Node Webkit, and don’t want to ask your users to install an external database. That’s when you need NeDB.
require and can be used as an in-memory only or persistent datastore. You can think of it as SQLite for MongoDB projects.
NeDB implements the most widely used features of MongoDB:
- CRUD operations including upserts
- Ability to persist data
- Expressive query language where you can use dot notation (to query on nested documents), regular expressions, comparison operators ($lt, $lte, $gt, $gte, $in, $nin, $exists) and logical operators ($and, $or, $not)
- Documents modifiers $set, $inc, $push, $pop, $addToSet and $each
- A browser version
Of course, NeDB is not a replacement for a “real” database such as MongoDB, so its goal is not to be as fast as possible, it is to be fast enough. And it is: using indexing, it achieves about 5,000 writes and 25,000 reads per second. If you need more than this, you’re probably not writing a small application!
Want to try it?
npm install it, the module name is
nedb. You can also check the Github repository to read the documentation, give feedback, raise issues or send pull requests