Lightweight Javascript DB for use in Node.js

ConfusedNoob picture ConfusedNoob · Aug 29, 2011 · Viewed 97.5k times · Source

Anybody know of a lightweight yet durable database, written in Javascript, that can be used with Node.js.

I don't want the 'weight' of (great) solutions like Mongo or Couch. A simple, in memory JS database with the capability to persist to disk as a file would be enough. I would only use it to store small amounts of data.

Requirements:

  • can run in process with a node.js server application
  • can save the whole database to disk and recover after a failure
  • NO need for atomic writes or transaction supports
  • fast queries and sorting would be nice
  • only needs to support small data volumes, up to 1MB in total

I've come across TAFFY db so far but it really doesn't seem optimized for use in Node.js. Anybody seen what I'm looking for out there?

Thanks

Answer

Louis Chatriot picture Louis Chatriot · May 24, 2013

I had the same requirements as you but couldn't find a suitable database. nStore was promising but the API was not nearly complete enough and not very coherent.

That's why I made NeDB, which a dependency-less embedded database for Node.js projects. You can use it with a simple require(), it is persistent, and its API is the most commonly used subset of the very well-known MongoDB API.

https://github.com/louischatriot/nedb