incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Cottlehuber <...@jsonified.com>
Subject Re: any good way of filtering out your own _changes?
Date Thu, 04 Oct 2012 08:20:56 GMT
On 4 October 2012 08:35, svilen <az@svilendobrev.com> wrote:
> so noone to suggest something?
>
>> > so i have a local db that replicates bidirectional with several
>> > others. an app uses local db, listens to _changes and also puts
>> > things sometimes. Any way to avoid it seeing it's own changes?
>
>> > i guess i can put a manual field e.g. "source" to *each* document or
>> > something... but that's not very neat. but may be the only way,
>> > hmmm - e.g. how to differ between different copies of same app..
>> > running in parallel.
>
> svil

I keep thinking that the right way to do this is to handle messages in
such a way that an incoming update doesn't force a refresh. This would
mean keeping a list of posted doc ids and simply removing them from
the list of pending "reverse updates" when they did come in. Depending
on what UI you are using, something like backbone's models might even
take care of that for you.

It's a question of volume - do you want to replicate *all* docs (easy,
no load for filtered replication), and absorb a little more network
bandwidth, or do you want to add an extra field, save the bandwidth,
and then use filtered replication which will mean running an
additional check on every replicated document for every user for every
chat room?

The former is IMHO far better. Although using an erlang filter would
be wicked fast.

Some reading for you around hooking couch to backbone:

http://janmonschke.com/projects/backbone-couchdb.html
https://github.com/pyronicide/backbone.couchdb.js
https://github.com/cloudant-labs/backbone.cloudant

A+
Dave

Mime
View raw message