2

I'm using a design document to ensure that only owners can modify docs. How can I prevent couchdb from replicating this design document?

redgeoff
  • 3,163
  • 1
  • 25
  • 39

1 Answers1

3

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);
redgeoff
  • 3,163
  • 1
  • 25
  • 39
  • Note: this is the default functionality when using https://github.com/redgeoff/factoryng, however, you can disable it using this method: http://stackoverflow.com/questions/26436821/include-design-documents-factoryng/26436823#26436823 – redgeoff Oct 18 '14 at 06:13