On 30 March 2013 18:30, Jens Alfke <[email protected]> wrote: > > > 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's definitely a pull replication > 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.) > > Yeah sorry about that, I assumed as the filter is running on the remote CouchDB that it must be a problem with my filter implementation, which it probably still is, and that TouchDB probably isn't the fault. > > 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. Have previously hardcoding rec.query, removed any references to doc.countries and it works. It even works without hard coding and taking the arguments from rec > 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. > > I've succesfully got the filter working without doc.countries. That's why I assumed it's an issue with my javascript on CouchDB rather than TouchDB 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 Ok thanks unless spots a problem with my filter and post on the mobile-couchbase group
