开发者

Recommend database in pure node.js with no dependencies?

开发者 https://www.devze.com 2023-03-15 12:21 出处:网络
I would like to know if a pure node.js web app can be developed, which means very simple deployment. From m开发者_Go百科y understanding since node.js is good at i/o, a database in node.js should be go

I would like to know if a pure node.js web app can be developed, which means very simple deployment. From m开发者_Go百科y 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.


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.


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.


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

Sorry for the short answer guys.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号