How to replicate design documents only?

前端 未结 3 2024
清歌不尽
清歌不尽 2021-02-04 07:29

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 no

相关标签:
3条回答
  • 2021-02-04 08:24

    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" ]
    }
    
    0 讨论(0)
  • 2021-02-04 08:26

    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/
    
    0 讨论(0)
  • 2021-02-04 08:31

    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.

    0 讨论(0)
提交回复
热议问题