Is there a filtered push replication example anywhere?



I’m looking for an example of how to use the filtered push replication. I see a filter property and filter params on the replication, but no obvious way to use this functionality.

Are there examples for how to do a filtered push?


Yes it is available in the documentation but again it depends on the couchbase lite version you are using.

for 1.4.1 you can refer to

Following is the code sample there in android:-
// Define a filter that matches only docs with a given “owner” property.
// The value to match is given as a parameter named “name”:
db.setFilter(“byOwner”, new ReplicationFilter() {
public boolean filter(SavedRevision revision, Map<String, Object> params) {
String nameParam = (String) params.get(“name”);
return nameParam != null && nameParam.equals(revision.getProperty(“owner”));
// Set up a filtered push replication using the above filter block,
// that will push only docs whose “owner” property equals “Waldo”:
Replication push = db.createPushReplication(url);
Map<String, Object> params = new HashMap<String, Object>();
params.put(“name”, “Waldo”);

I am not sure if we have enough documentation for 2.0 or it is implemented for 2.0 (fyi @priya.rajagopal, @jens @househippo)

I tried but for 2.0 its not in config and not a property of database.

Please alway make sure to provide the version you are using.


Thank you, that is what I was looking for.

We’re using at the moment, but it would be interesting to know if this feature is present in 2.0.


filterParams on push replication is not yet supported in 2.0. It’s being tracked for future releases. You can filter on documentIds though.