On Mar 30, 2013, at 10:12 AM, John <[email protected]> wrote:

> I'm using an android client (TouchDB) to do a filtered replication.

How are you using the filter function? If you’re specifying a filter in a pull 
replication, the filter function lives in (and runs on) the remote server. If 
it’s in a push replication, the function runs locally.

It really helps to say explicitly right up front what software and version 
you’re using, on the client as well as the server side. In particular, the 
Android version of TouchDB is rather unfinished, sort of in a pre-alpha state 
of development. (FYI, I’m the author of the iOS/Mac version of TouchDB, from 
which the Android version is ported.)

> Soon as
> I have any mention of docs.countries in the filter function it fails to
> replicate. I get an IOException error, which I assume is due to the fact
> docs.countries is failing and causing nothing to get replicated. If I
> filter on docs.expiryDate alone it works.

If this is a push replication, the problem might be that query parameters 
aren’t supported on Android, that is, rec.query might be undefined. IIRC, the 
initial implementation of filters didn’t support parameters, and that might not 
have been added to the Android version yet. So try replacing your use of 
rec.query with a hardcoded string like “GB” and see if that works.

If this is a pull replication, TouchDB/Android might not be passing the 
“?filter=“ parameter to the remote server’s _changes feed. Again, it’s possible 
this wasn’t originally supported. But I don’t know much about the exact 
development state of TouchDB/Android.

It’d be best to discuss this further either on the mobile-couchbase Google 
group, or by filing a Github issue against TouchDB-Android.

—Jens

Reply via email to