Creating view using command line or script


Hi everybody,
what’s the most recommended way to pass views from environment to environment.
my scenario is this: I have 3 environments with 3 different CB clusters - TEST, STAGING, PROD.
I create a view on TEST env and then want to propagate it to STAGING and then to ORT. I don’t have access to neither staging nor prod, so I have to prepare a script for our devops guys that will create the view.

I think I can use cbbackup + cbrestore -x design_doc_only=1 -x rehash=1

but I don’t like it, since the ‘restore’ command has a harmful potential.
is there a better way? is there a way with ruby/python SDK?



Hi, View management is REST based so the most portable thing from my perspective would be to use any scripting you like and use that REST API:


In addition, note that the SDKs support design document management (creating, deleting or replacing design documents), which includes individual views. See each SDK documentation for background.