Filter design documents with PouchDB

怎甘沉沦 提交于 2019-12-13 00:39:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!