Skip to content
simple jQuery plugin that let you add event handler on CouchDB changes feed
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
README.md
couchdb.changes.js

README.md

CouchDB Changes

A JQuery plugin for binding event handlers to the CouchDB _changes feed.

Features

  • Bind an event handler to a database _changes longpoll feed.
  • Bind an event handler for monitoring of a specific document changes.

TODO

Usage

  • $.couchdb.changes.database(database, callback):

    
    $.couchdb.changes.database("test", function(changes){
         $('ul').append("
  • " + changes.last_seq + "
  • "); });
  • $.couchdb.changes.document(database, document, callback):

    
    $.couchdb.changes.document("test", "test-doc", function(doc){
         $('ul').append("
  • " + doc._rev + "
  • "); });

Stopped working on the pluggin because of the jquery.couch.js include changes feature as well.

Note that this is not included in the plugin shipped with CouchDB 0.11.0!

Here is a code snippet that shows how to use this:


    
    // database changes
    $.couch.db('test').changes().onChange(function(resp){
        console.log(resp);
    });
    
    // include the documents
    $.couch.db('test').changes(null, { "include_docs" : "true" }).onChange(function(resp){
        console.log(resp);
    });
    
    
Something went wrong with that request. Please try again.