I have a bidirectional replication set up between PouchDB and CouchDB and I want to filter the replication so that only relevant documents end up in my local pouch.
pouchDB('medic').sync('http://localhost:5984/medic', {
live: true,
retry: true,
filter: 'medic/doc_by_place'
});
When I execute the sync I get Uncaught ReferenceError: require is not defined
from an anonymous function below.
(function () { return function(){return require("lib/app")["filters"]["doc_by_place"].apply(this, arguments);} })()
Where is this coming from and why is require
not defined?
This error is coming from the to side of the
sync
not the from side. Server side filters only make sense on from calls. To filter the to replication execute an adhoc filter function.I ended up splitting the replication into two as below.