FANDOM


There are many ways to "Persist" (save) data in Node.js.

Historically MySQL/Databases were the only way to store data (With Excel being a close second :) ). Now - in Node at least - SQL is not even the most popular system. NoSQL works well with Node because Node's basic storage system is JSON and most NoSQL systems are (essentially) JSON stores.

The SF Node.js meetup recently had a NoSQL blowout. Here are the primary systems showcased and a quick summary of their strengths and weaknesses; keep in mind my only direct experience is with MongoDB.

Some NoSQL systemsEdit

System Record Type NodeSupport Unique Strengths Shortcomings
Redis String/Binary block, hash, set redis, hiredis Very fast, VERY simple, memory resident Data integrity not guaranteed
MongoDB BSON (Binary JSON) mongo-native, mongoose Very scalable, shardable, replication; Mongoose gives Schema support Can get somewhat complex; not natively transactional.
CouchDB JSON (core HTTP routines) REST based - no ORM needed, and can be accessed by client services. Very mature (as NoSQL systems go). Natively transactional. Write-only, and so, EXTREMELY reliable. Views must be preindexed (which just means they require some preparation).

It's worth noting that if you don't really care about saving data after your node process shuts down, you can just store information in arrays of obects attached to a module. For applications like gaming, chat or other nonfinancial systems, this (crude) system is actually often quite responsive and satisfactory. And you can always save JSON to files for small datasets.

MySQLEdit

If anyone out there has used MySQL with node please let us know how it went :D

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.