Filter 使用数据库过滤设计文档

Filter 使用数据库过滤设计文档,filter,replication,pouchdb,design-documents,Filter,Replication,Pouchdb,Design Documents,我使用设计文档来确保只有所有者才能修改文档。如何防止couchdb复制此设计文档?您可以使用中的changes()和replicate(),例如 var opts = { live: true, filter: function(doc) { return doc._id.indexOf('_design') !== 0; } }; var db = new PouchDB('todos'); db.replicate.to('http://localhost:5984/t

我使用设计文档来确保只有所有者才能修改文档。如何防止couchdb复制此设计文档?

您可以使用中的
changes()
replicate()
,例如

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);

注意:这是使用时的默认功能,但是,您可以使用以下方法禁用它: