Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including follow-db-updates with all npm packages installed. Try it out:

var followDbUpdates = require("follow-db-updates")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

follow-db-updates v0.0.2

Easy CouchDB _db_changes follower, with older couch pollyfill

Follow DB Updates

CouchDB 1.4.0 introduced the _db_updates endpoint for watching for created and deleted databases. This module makes it easy to consume this endpoint, and provides a poll based pollyfill for older versions of CouchDB

Install

npm install follow-db-updates

Usage

var DBUpdates = require('follow-db-updates');
var changes = new DBUpdates('http://admin:pass@localhost:5984');



changes.on('init', function(db_list){
    // on init we provide a list of all the current databases
})

changes.on('data', function(change){
    console.log(change); // change is one of the following
                         // { type: 'created', db_name: 'aaaaa' }
                         // { type: 'deleted', db_name: 'aaaaa' }
})

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free