Trying to add pull filter in Couchbase Lite...
Added filter in design document
"filters": {
"user": "function(doc,req) { if(doc.type == 'user' && email == req.query.email) {return true;} return false;}"
}
In C# replicatoin code added following:
pull.Filter = "myview/user";
pull.FilterParams = new Dictionary<string, object> { { EnumUtil.UserDocument.email.ToString (), App.user.email }};
Filter work sometimes but not always...
How to add pull filter correctly or any other way to replicate user specific data to app using Couch? Channel will not help as I may have many users and need to show data only for specific user...
For filtering in Couchbase Lite, the parameter values are specified in the 'Replication.filterParams' property as a dictionary and passed into the filter function where it would match only docs with the specified given owner' property.
Can also reference the Replication Guide for more in-depth examples and discussions on the topic.