incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <robert.new...@gmail.com>
Subject Re: filters for _changes dont seem to work
Date Sun, 29 Nov 2009 22:33:04 GMT
I'm not sure the API is quite as you say. When using feed=continuous
you do see all the changes, since it's just being passed to an event
listener of some kind. Where you do, definitely, see 'gaps' is when
you use _changes retrospectively.

1) create a new database.
2) create 4 documents (say).
3) run _changes
4) update the first of the documents made in step 2.
5) run _changes

You'll see that seq:1 from step 3) is omitted in step 5), replaced by
a seq:5 for the updated document;

Umbrage:~ robertnewson$ curl
"http://localhost:5984/db2/_changes?feed=continuous&heartbeat=20000"
{"seq":1,"id":"b23c6a0031d8f3dfef50e86a12a7e2c0","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
{"seq":2,"id":"d56681b73389ccffa742ee5bd2c98bfd","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
{"seq":3,"id":"8b99addfc786acafc1138b3d3168b108","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
{"seq":4,"id":"7496dea85df8e58f0801d8ae9572d4fa","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
^C
Umbrage:~ robertnewson$
Umbrage:~ robertnewson$ curl
"http://localhost:5984/db2/_changes?feed=continuous&heartbeat=20000"
{"seq":2,"id":"d56681b73389ccffa742ee5bd2c98bfd","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
{"seq":3,"id":"8b99addfc786acafc1138b3d3168b108","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
{"seq":4,"id":"7496dea85df8e58f0801d8ae9572d4fa","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
{"seq":5,"id":"b23c6a0031d8f3dfef50e86a12a7e2c0","changes":[{"rev":"2-7051cbe5c8faecd085a3fa619e6e6337"}]}

_changes yields the latest versions of all documents in the order that
they occurred. It's just that an active feed=continuous request will
see transient intermediate stages.

B.

On Sun, Nov 29, 2009 at 10:23 PM, Chris Anderson <jchris@apache.org> wrote:
> On Sun, Nov 29, 2009 at 12:55 PM, Sebastian Cohnen
> <sebastiancohnen@googlemail.com> wrote:
>> Hey Chris,
>>
>> On 29.11.2009, at 20:05, Chris Anderson wrote:
>>
>>> To be clear, the _changes API doesn't guarantee that you'll get every
>>> single change. If a document is changed many times in quick succession
>>> it's possible that only the latest state will appear in the _changes
>>> feed.
>>
>> okay, that was not the way I understood the _changes-feed. Is there an API interface
that guarantees me to tell all changes?
>>
>
> No, there is no API for that. I think you'll find the _changes API is
> actually what you want. If a document is changed, you are guaranteed
> to be notified, it's just that if the same document is changed lots of
> times, you may not see all the intermediate states.
>
> This behavior is inherent in CouchDB's data-model, as it is used to
> drive replication, view indexing, and external indexers. Hopefully it
> works for your purposes as well.
>
> Chris
>
> PS thanks for adding to the ticket, Roger.
>
>
> --
> Chris Anderson
> http://jchrisa.net
> http://couch.io
>

Mime
View raw message