问题描述
我正在尝试学习CouchDB,可以在Futon中创建视图等,但是我想在桌面上编写设计文档,然后使用cURL上载它们。 权威指南显示了使用cURL更新内容文档,但所有设计文档都是Futon或CouchApp。
I'm trying to learn CouchDB and I can create views and such in Futon, but I want to write my design documents on the desktop and the upload them using cURL. The 'Definitive Guide' shows updating content documents with cURL but all the design documents are either Futon or CouchApp.
我想将当前的设计文档下载到本地文件,编辑文件,然后将其发送回CouchDB。
I'd like to download the current design doc to a local file, edit the file, then send it back to CouchDB.
下载和上传CouchDB设计文档的cURL命令是什么?
What are the cURL commands to download and upload CouchDB design documents?
推荐答案
将数据库 dev-task中的设计文件 task下载到文件 task.json中:
Download the design file "task" in database "dev-task" to file "task.json" :
curl http://localhost:5984/dev-task/_design/task > task.json
一旦文件被编辑,就可以放回去。
Once the file is edited, you can put it back.
curl -X PUT http://localhost:5984/dev-task/_design/task -d @task.json
之所以有效,是因为 task.json
包含一个适当的修订号。如果要再次更改文件,则需要先重新下载它以获得最新的修订号。
This works because task.json
contains an appropriate revision number. If you want to change the file again, you need to re-download it first to get the latest revision number.
这篇关于如何使用cURL将设计文档上传到CouchDB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!