Update Design Document Java SDK


#1

There are methods to create, get and delete design documents, but there is no update. How can I add new views to an existing design document.


#2

You get the current version of the design document via get add your new view and store it under the same Id again. Underneath this is just using HTTP so basically it looks like this when using no SDK

$ curl http://localhost:8092/default/_design/test > view.json $ vim view.json { "views": { "foo": { "map": "function (doc, meta) {emit(meta.id, null);}" }}} (make your changes ...) $ curl -XPUT -H'Content-Type: application/json' http://localhost:8092/default/_design/test -d @view.json {"ok":true,"id":"_design/test"}

Or in Java you can do the same via the provided methods to get the design doc, modifying it, and saving it back via create under the same ID.