-
Notifications
You must be signed in to change notification settings - Fork 77
Home
There are three essential components for most flexibly interacting with CouchDB from node:
couch API documentation: http://jpmens.net/2010/04/20/the-antepenultimate-couchdb-reference-card/ http://www.couchbase.org/sites/default/files/uploads/all/documentation/couchbase-api.pdf
javascript HTTP library: http://github.com/mikeal/request
javascript _changes feed consuming libaries (pick one): http://github.com/mikeal/dbemitter (see the tests folder for example uses) https://github.com/iriscouch/follow
You won't find the string 'CouchDB' inside the source code for the request library. This is because request is a generic HTTP library and CouchDB implements an HTTP API. You don't need any fancy abstraction/ORM/client libraries for Couch (more on this theory here http://www.mikealrogers.com/posts/abstracting-couchdb.html)
Essentially it boils down to understanding the couch data model and API and then writing HTTP queries to interact with it. Another pattern involves using "_changes consumers" to create a sort of "2.1" tier architecture where you have node essentially open a socket and listen to couch and react to changes. Because this is a bunch of HTTP boilerplate it has been abstracted into couch specific modules (follow and dbemitter - pick whichever appeals to you more).