Skip to content

Commit

Permalink
[doc] Update README.md with references to follow
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Feb 22, 2012
1 parent 5828266 commit 1f11f28
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions README.md
Expand Up @@ -330,18 +330,17 @@ the affected documents, simply pass `include_docs: true` in the options.

### Streaming #

You can also *stream* changes, by calling `db.changes` without the callback:
You can also *stream* changes, by calling `db.changes` without the callback. This API uses the **excellent** [follow][0] library from [IrisCouch][1]:

``` js
db.changes({ since: 42 }).on('response', function (res) {
res.on('data', function (change) {
console.log(change);
});
res.on('end', function () { ... });
var feed = db.changes({ since: 42 });

feed.on('change', function (change) {
console.log(change);
});
```

In this case, it returns an `EventEmitter`, which behaves very similarly to node's `Stream` API.
In this case, it returns an instance of `follow.Feed`, which behaves very similarly to node's `EventEmitter` API. For full documentation on the options available to you when monitoring CouchDB with `.changes()` see the [follow documentation][0].


Other API methods
Expand Down Expand Up @@ -374,3 +373,5 @@ Other API methods
- `viewCleanup()`: Cleanup old view data
- `replicate(target, options)`: Replicate this database to `target`.

[0]: https://github.com/iriscouch/follow
[1]: http://iriscouch.com

0 comments on commit 1f11f28

Please sign in to comment.