couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "slubowsky@netzero.net" <slubow...@netzero.net>
Subject filters for _changes dont seem to work
Date Wed, 25 Nov 2009 19:12:22 GMT
I am trying to use a simple filter to filter the changes I get when asking for changes using
the _changes API. 

I find that often the filter is not even called (I write a message to the log when the filter
is called, when it returns false, and when it returns true) and I don't get changes I should
have received (especially changes to existing documents, new documents seem to do better,
deletes never get included, not even the first one). 

What typically happens is that the first couple of changes do get through as expected (and
I see the appropriate log messages written by the filter) but then after a few updates, my
filter doesn't even get called (I see no log messages from my filter) and couch seems to decide
on its own not include the change but just updates the last_seq number and sends that.

My filter and a snippet of the log file showing one PUT causing the filter to be called and
a change sent out, followed by a nearly identical PUT that doesn't even cause the filter to
be called and the change fails to get sent out follows.

Any help would be appreciated.
Thanks
Stephen

function(doc, req) { 
    log('filter called'); 
    if(req.query.time >= doc.dateOf_) { 
        log('filter passed'); 
        return true; 
    } else { 
        log('filter failed'); 
        return false; 
    }
}

[Wed, 25 Nov 2009 13:37:06 GMT] [info] [<0.11350.0>] 10.50.17.52 - - 'GET' /thing0a321134-24df-0585/_changes?feed=longpoll&timeout=10000&since=84&filter=test/deltas&time=1259170547605&_=1259174167457
200

[Wed, 25 Nov 2009 13:37:14 GMT] [info] [<0.11363.0>] 127.0.0.1 - - 'PUT' /thing0a321134-24df-0585/C41924D7-8B00-0001-D841-1E21AD40B120
201

[Wed, 25 Nov 2009 13:37:14 GMT] [info] [<0.7003.0>] OS Process :: filter called

[Wed, 25 Nov 2009 13:37:14 GMT] [info] [<0.7003.0>] OS Process :: filter passed

[Wed, 25 Nov 2009 13:37:15 GMT] [info] [<0.11023.0>] 10.50.17.52 - - 'GET' /thing0a321134-24df-0585/_changes?feed=longpoll&timeout=10000&since=85&filter=test/deltas&time=1259170547605&_=1259174176091
200

[Wed, 25 Nov 2009 13:37:15 GMT] [info] [<0.4049.0>] checkpointing view update at seq
85 for thing0a321134-24df-0585 _design/test

[Wed, 25 Nov 2009 13:37:21 GMT] [info] [<0.11382.0>] 127.0.0.1 - - 'PUT' /thing0a321134-24df-0585/C41924D7-8B00-0001-D841-1E21AD40B120
201

[Wed, 25 Nov 2009 13:37:22 GMT] [info] [<0.11350.0>] 10.50.17.52 - - 'GET' /thing0a321134-24df-0585/_changes?feed=longpoll&timeout=10000&since=86&filter=test/deltas&time=1259170547605&_=1259174182984
200
 

____________________________________________________________
Human Resource Training
Complete an accredited human resources degree, 100% online. Free info!
http://thirdpartyoffers.netzero.net/TGL2231/c?cp=FFjGpJY4nPYAJ60w7RLkJAAAJz7PXgnlLC7u5ZtKh1zh0o-lAAQAAAAFAAAAAEa2Mz4AAAMlAAAAAAAAAAAAAAAAAAASIwAAAAA=

Mime
View raw message