I think I'm going about something wrong here, maybe someone can clarify. I have an app that long polls CouchDB (via nodejs) for which it uses the changes feed. When my app makes it's first poll of the changes feed it doesn't know what the last_seq is so I've just been starting by polling with since=0, getting the last_seq and then polling again with since=last_seq.
However, I've run into a problem. Since my database has had several more documents added to it , the changes list is getting awfully long and when I request changes with since=0, the response appears to be getting cut off and I don't get the last_seq in the response. Hence I can't make a subsequent request without that last_seq.
Is there a way to get the last_seq without getting AAAAALLLL the changes from the beginning of time? Is there some way to truncate the changes feed every so often?
Bah, nevermind. As usual I find my answer right after I post!
GET /dbname/_changes?descending=true&limit=1
From this post: How to get last created document in couchdb?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With