TiansHUo
TiansHUo

Reputation: 8629

Recommend database in pure node.js with no dependencies?

I would like to know if a pure node.js web app can be developed, which means very simple deployment. From my understanding since node.js is good at i/o, a database in node.js should be good too. Does one exist? Especially one that lives in RAM and occasionally persists to disk.

Upvotes: 2

Views: 6039

Answers (3)

Alfred
Alfred

Reputation: 61771

First of I don't see the problem in installing redis or mongodb. It can be done without any effort at all.

That said there are a number of such databases like:

  • ministore: save at specified intervals.
  • alfred: Reads are fast because indexes into files are kept in memory.
  • nStore: Also a index of all documents and their exact location on the disk is stored in in memory for fast reads of any document.
  • jsonds: Jsonds is a 'data store' which is just a JSON object which is written to disk at a set frequency.
  • supermarket
  • chaos
  • node-dirty
  • node-tiny
  • nedb: Embedded pure JS database with MongoDB-compatible API.

Also most of these product are very young and should probably not be used in production yet.


You could also code something yourself I assume using node-sqlite3 to store data back to disc.

Upvotes: 10

RobertPitt
RobertPitt

Reputation: 57268

Try looking here: https://github.com/joyent/node/wiki/modules#database

Sorry for the short answer guys.

Upvotes: 0

user334899
user334899

Reputation:

If you want a database in Node that exists only in ram you could simply use javascript objects and arrays to contain your data. If you need something more powerful with queries that ressemble SQL, then maybe pure javascript objects would not be the best idea. Also, with this idea you could make it persistant by flushing the data to disk using JSON.stringify at a set interval.

Upvotes: 2

Related Questions