NeDB - Lightweight Database in JavaScript |
Written by Kay Ewbank |
Monday, 24 June 2013 |
If you want to play with an embedded persistent database for Node.js, you might find what you’re looking for in NeDB. The author, Louis Chatriot, says he wanted a lightweight database written in JavaScript that he could use with Node.js. He didn’t want the overheads of MongoDB or Couch, just something in-memory that could persist data to disk as a file. As he couldn’t find a suitable database, he did what any sensible developer does – wrote one himself in JavaScript. NeDB can be used with a simple require(), is persistent, and its API is the most commonly used subset of the MongoDB API. Chatriot says you can think of NeDB as a SQLite for Node.js projects, which can be used with a simple require statement. You can use it as a persistent or an in-memory only datastore. One datastore is the equivalent of a MongoDB collection. NeDB does support indexing, and you can index any field, including fields in nested documents using the dot notation. For now, indexes are only used to speed up basic queries and those using $in, $lt, $lte, $gt and $gte.
The description on GitHub says that “NeDB is not intended to be a replacement of large-scale databases such as MongoDB! Its goal is to provide you with a clean and easy way to query data and persist it to disk, for web applications that do not need lots of concurrent connections, for example a continuous integration and deployment server and desktop applications built with Node Webkit.” Chatriot says he’s benchmarked NeDB against TaffyDB and NeDB is much, much faster, so he’s planning on porting it to browsers.
More InformationRelated ArticlesConnector for Node.js in MySQL Cluster
To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin, or sign up for our weekly newsletter.
Comments
or email your comment to: comments@i-programmer.info
|
Last Updated ( Monday, 24 June 2013 ) |