You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/01/20 14:31:10 UTC

[GitHub] [couchdb] tomasged opened a new issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?

tomasged opened a new issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?
URL: https://github.com/apache/couchdb/issues/2474
 
 
   Hi, 
   
    we want to use PouchDB in an app and we don't want it to replicate the whole database: we want it to start listening to / replicating changes from a specific document onwards.
   
    Given the sequence number is a string, we cannot use POST _changes?filter=doc_ids to get the minimum sequence of those minus one (since "since" in CouchDB _changes is not inclusive, but exclusive, it gives documents after the provided sequence number so at least one document will be missed with this approach), besides the order is not guaranteed between calls to _changes as stated in the documents so it doesn't look realistic to use "since" with _changes.
   
    Which solution can be applied here? Thanks.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] tomasged commented on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?

Posted by GitBox <gi...@apache.org>.
tomasged commented on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?
URL: https://github.com/apache/couchdb/issues/2474#issuecomment-576714981
 
 
   Thank you both, @lostnet & @wohali . It's clear that we'll need to re-engineer the solution and be creative with what's now given.
   
   This issue can be closed if no one else has other ideas.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] wohali closed issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?

Posted by GitBox <gi...@apache.org>.
wohali closed issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?
URL: https://github.com/apache/couchdb/issues/2474
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] tomasged edited a comment on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?

Posted by GitBox <gi...@apache.org>.
tomasged edited a comment on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?
URL: https://github.com/apache/couchdb/issues/2474#issuecomment-576565408
 
 
   Our case is that the database is the source of truth. A user logins and that user only needs to start listening / replicating from the beginning of a bunch of documents. Normally, at 3/4 of the database.
   
   Retrieving such documents and then using changes with "now" could mean that between those two operations some changes are lost... I guess they should work in parallel but that just complicates things: first, changes with since=now and afterwards retrieving the documents of interest with a startKey since the IDs of the new generated documents are unknown (imagine a tree of documents with a common root). 
   
   We are used to use it with PouchDB as described in my first comment ("since" value of the minimum sequence of that bunch of documents minus one), but with the sequence number change for CouchDB 2.x, it destroyed that possibility I guess 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] tomasged commented on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?

Posted by GitBox <gi...@apache.org>.
tomasged commented on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?
URL: https://github.com/apache/couchdb/issues/2474#issuecomment-576565408
 
 
   Our case is that the database is the source of truth. A user logins and that user only needs to start listening / replicating from the beginning of a bunch of documents. Normally, at 3/4 of the database.
   
   Retrieving such documents and then using changes with "now" could mean that between those two operations some changes are lost... I guess they should work in parallel but that just complicates things: first, changes with since=now and afterwards retrieving the documents of interest with a startKey since the IDs of the new generated documents are unknown (imagine a tree of documents with a common root). 
   
   We are used to use it with PouchDB as described in my first comment (since value of the minimum sequence of that bunch of documents minus one), but with the sequence number change for CouchDB 2.x, it destroyed that possibility I guess 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] lostnet commented on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?

Posted by GitBox <gi...@apache.org>.
lostnet commented on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?
URL: https://github.com/apache/couchdb/issues/2474#issuecomment-576713117
 
 
   @tomasged If I've understood the problem correctly, I think you can use `/db/_changes?descending=true&since=[firstdocseq]&limit=2` to get a potential previous sequence to use in replications, then you would need to verify that you've been given at least the documents you want or re-replicate and make sure your code can live with any additional documents from different order responses..
   
   A different approach might be to rely on a view and an application layer source of order (i.e. timestamp fields?) 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] wohali commented on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?

Posted by GitBox <gi...@apache.org>.
wohali commented on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?
URL: https://github.com/apache/couchdb/issues/2474#issuecomment-576377216
 
 
   Can you just `GET` that document+revision first, then start the changes feed right after it?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] wohali commented on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?

Posted by GitBox <gi...@apache.org>.
wohali commented on issue #2474: Discussion: How do I get a "since" value for _changes starting from a specific document?
URL: https://github.com/apache/couchdb/issues/2474#issuecomment-576754474
 
 
   @tomasged For reference, it's better to ask these questions on our user mailing list than here, or on our Slack, if you want a wider variety of answers. Details for subscription are at https://couchdb.apache.org/

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services