changes
A consistent, fault tolerant CouchDB _changes listener with pre-fetch support.
Usage
var Changes = ;var changes =url: 'http://user:pass@127.0.0.1:5984/database'timeout:max: 60000step: 5000;//// Dump changes as they come in.//changes;//// The callback will be called once a _changes// connection has been established or with an// error if the first connection fails.//changes;
Pre-fetching Views
Often when you establish a connection to _changes
you also want to know about the other documents in a view before the current update_seq
. This is supported like this:
var Changes = ;var changes =url: 'http://user:pass@127.0.0.1:5984/database'views:'important':path: '_design/Some/_view/name'query: include_docs: truetimeout:max: 60000step: 5000;//// All rows from a queries view will be emitted// in the `views:<name>` event **before** the// `_changes` listener starts.//changes;//// Dump changes as they come in.//changes;//// The callback will be called once a _changes// connection has been established or with an// error if the first connection fails.//changes;