使用PouchDB过滤设计文档

时间:2014-10-16 01:53:19

标签: filter replication pouchdb design-documents

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

1 个答案:

答案 0 :(得分:2)

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

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