-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove local_seq #4080
Comments
The ?local_seq=true option is still active in couchdb, and I don't see how else to get the sequence number matching the current rev of a document. I'm tasked with providing a promise for a particular replication stream being up-to-date with regard to a particular doc@rev, which is easy if I can get its seq. Is there a recommended pouchdb alternative (that works with a remote db) that returns such seq? |
This depends a lot about what you're trying to do, it's a bit tricky Unfortunately PouchDB sequence numbers do not match CouchDB sequence numbers since 2.0, and if CouchDB runs in multi-node mode CouchDB sequence numbers might not match each other either. What you can do is to store the result of your push replication (i assume this is about whether you uploaded all your changes to the server) in a local doc, then use that sequence to look for changes after that number localDB.changes({ since: last_push_update_seq, doc_ids: 'myDocID' })
.then(changes => {
// if there's no changes to this doc since last sync, you're good
return changes.results.length === 0
}) If you are online, you can compare the revision on your local doc against the revision on the server. Storing the last update seq of a replication is a bit involved and i'm sorry i can't provide that to support your project, but in general:
|
Thanks for this. It opens some options I hadn't seen. Especially appreciating the heads-up about server seq numbers when using a couchdb cluster. |
Might as well get this in for 4.0.0.
The text was updated successfully, but these errors were encountered: