Node.js Persistence Options - Mongoose
Video Course on Building Web Applications with Node.jsoptions:
- SQL libraries (but not very popular)
- Postgres (JSON column) has best community support
- Document based stores are more popular, good fit for JS
- MongoDB or CouchDB are popular
- redis - fast for in-memory data storage
Mongoose
works pretty well
MongoDB is interesting for Mongoose, a full-featured, object-oriented interface for a datastore. Can add restrictions, validation, duplicate checking – features that don't exist out of the box
- Object Document (ODM)
- Nice hhg level APIs.
- well documented
Mongoose Concepts: SCHEMA
define the structure of the objects you want to store (MongoDB doesn't enforce any structure on a data)
MongoDB uses document collections insted of data tables
collection => table
document => row
can define properties on the SCHEMA object (what types of data are valid for a given property)
define validations, define fuctions on the datatype (like find etc)
Mongoose Concepts: MODEL
represnetation of a MongoDB document.
use the model to query database, update properties, modify the associated documents
hosted mongodb: MongoHQ and MongLabrecomends MongoHQ - easier to provision and setup