You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Steve Foulkes <sf...@fnal.gov> on 2010/11/24 22:55:29 UTC

Changes API and document revisions

I have a service that polls the _changes API and noticed that it will 
only return the latest revision of a document.  For example:

poll _changes last_seq = 1

update doc1 -> rev1, seq = 2
update doc2 -> rev1, seq = 3
update doc1 -> rev2, seq = 4

poll _changes, last_seq = 1

The last call to the _changes will return changes for doc1 and doc2 but 
only sequence 4 for doc1.  Is there any way to retrieve all of the 
documents and sequences from _changes?  The _all_docs_by_seq view works 
the same way.

Steve

Re: Changes API and document revisions

Posted by Robert Newson <ro...@gmail.com>.
The _changes feed only returns the latest version of any document. If
you are following it continuously, you will see each change to a
document, but if you call it again, you'll see gaps.

This is by design. The reason _changes and _all_docs_by_seq work the
same way is because they're reading the same b+tree (_changes is
really the new name for _all_docs_by_seq).

The point of _changes is to allow you to synchronize another resource
to match the source. couchdb replication uses it, and other software
like couchdb-lucene uses it for this purpose. It is *not* an API for
replaying every historical event.

B.

On Wed, Nov 24, 2010 at 9:55 PM, Steve Foulkes <sf...@fnal.gov> wrote:
> I have a service that polls the _changes API and noticed that it will only
> return the latest revision of a document.  For example:
>
> poll _changes last_seq = 1
>
> update doc1 -> rev1, seq = 2
> update doc2 -> rev1, seq = 3
> update doc1 -> rev2, seq = 4
>
> poll _changes, last_seq = 1
>
> The last call to the _changes will return changes for doc1 and doc2 but only
> sequence 4 for doc1.  Is there any way to retrieve all of the documents and
> sequences from _changes?  The _all_docs_by_seq view works the same way.
>
> Steve
>