These are the most canonical sources I can find.
 http://docs.cloudant.com/guides/replication/replication.html#filtered-replication
 http://docs.couchdb.org/en/latest/replication/index.html
 http://docs.couchdb.org/en/latest/couchapp/ddocs.html#filter-functions
 http://docs.couchdb.org/en/latest/json-structure.html#replication-settings

But I feel that they don't do a very good job providing a simple example, especially from the point of view of the mobile app developer.