I have a problem in replication with filter. Everything works ok, but when i would like to change the category name which pass the filter in source db, the same record in target database still exists, but it doesn't pass the filter now, so the record in the target database should be deleted. How can i solve this problem? There is my replication function. :
nano.db.replicate('db1', 'db2',
{ create_target:true, continuous: true, filter: 'DESIGNDOCUMENT/CATEGORY' }).then((body) => {
console.log(body);
});
And below is my replication filter:
{
"_id": "_design/DESIGNDOCUMENT",
"_rev": "2-4c0bde4916dcaf68c58d904792f191f0",
"filters": {
"CATEGORY": "function(doc, req) { if (doc.category === 'category1' ) { return true; } return false; }"
}
}