问题
I'm using a design document to ensure that only owners can modify docs. How can I prevent couchdb from replicating this design document?
回答1:
You can use the filter option in changes()
and replicate()
, e.g.
var opts = {
live: true,
filter: function(doc) {
return doc._id.indexOf('_design') !== 0;
}
};
var db = new PouchDB('todos');
db.replicate.to('http://localhost:5984/todos', opts);
来源:https://stackoverflow.com/questions/26394999/filter-design-documents-with-pouchdb