iriscouch / follow

Very stable, very reliable, NodeJS CouchDB _changes follower
Apache License 2.0
393 stars 82 forks source link

Feature Request: negative since #5

Closed mikeal closed 12 years ago

mikeal commented 12 years ago

It would be really nice if I could do:

var seq;

var f = follow(url)
f.since = -2
f.on('change', function (info) {
  seq = info.seq
})

So, -1 would actually be since=currentSequence. And -2 would be since (currentSequence - 1). That way, I could use -2 and as soon as the feed connects i'll get my global for the current sequence back.

jhs commented 12 years ago

That's a great idea. It matches Python's convenient negative array indices. And it is a good excuse to integrate https://github.com/iriscouch/probe_couchdb and give it more real-world exercise. Probe CouchDB already knows the last_seq and depends on the same version of request.

Hm, it looks like there is an undocumented feature .since = "now" but -2 would be pretty cool.