Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replicate design documents only?

Tags:

couchdb

So I want to replicate some changes I made to my design files from dev to production (a.k.a. I want to deploy something).

I'm somehow confused since my research did not lead to any concrete results. Although this seams IMHO like a pretty obvious use case.

Am I missing something?

like image 679
Aron Woost Avatar asked Sep 05 '11 14:09

Aron Woost


3 Answers

You can specify the document IDs to replicate, without having to write a filter. Post the replication document (or command) like so:

{ "source": "my_db"
, "target": "http://target:5984/target_db"
, "doc_ids": [ "_design/my_ddoc" ]
}
like image 115
JasonSmith Avatar answered Nov 10 '22 16:11

JasonSmith


You can use 'Filtered Replication' (See http://wiki.apache.org/couchdb/Replication#Filtered_Replication for details)

Basically, you'll supply a function that returns true for design documents like;

function(doc, req) {
  return "_design/" === doc._id.substr(0, 8)
}

and then add "filter":"ddocname/filtername" to your _replicate request body.

like image 36
Robert Newson Avatar answered Nov 10 '22 17:11

Robert Newson


I keep my design documents stored as .js files on disk. Then I use couchdb-update-views to update the design documents on a server

npm install -g couchdb-update-views
couchdb-update-views --config /path/to/config.json --docsDir /path/to/design/docs/directory/
like image 1
Noah Avatar answered Nov 10 '22 16:11

Noah