At first, this question appeared to be too trivial to me to actually require a Stackoverflow post. However, after executing many Google searches for the information, I am at a lost when trying to figure this out about Couchbase.

In Couchbase (I am using the 2.2 Community version), how do I share views among developers? Is there some sort if import/export functionality available? If not, then how does Couchbase intend for developers to share the views that they are using without needing to do manual copying/pasting? It is obvious that the code that a development team would write for querying Couchbase will require accurate view names. Without having a way to send a developer a view file, to accurately setup a Couchbase DB, how can it even be possible to develop with Couchbase locally as a team?

I'm sorry if I sound a little desperate or harsh here, but if it isn't possible to share views among multiple developers, then I don't see how Couchbase can be a viable DB solution for a team of developers trying to share database configuration, similar to how a team using an SQL DB would share schema files to set up the DB.

有帮助吗?

解决方案

Several ways you can approach this:

1) Create views programmatically as demonstrated here in java:

http://tugdualgrall.blogspot.com.es/2012/12/couchbase-101-create-views-mapreduce.html

or here in node.js:

http://www.tuicool.com/articles/RvYbQn

2) Store all your views in your version control system (This is the option I use). If you are developing locally then only you need your personal view code, once they are working and your tests are all passing then you can check them in.

I assume you'd then be developing on an testing environment so yes sadly here you'd have to update the views either by hand or by using option 1.

You could also take a look at perhaps using this tool but only for views: http://www.couchbase.com/communities/q-and-a/how-bulk-import-design-docs-and-views-couchbase-server

其他提示

This functionality currently is not available in the admin UI.

There is a defect/enhancement open Ability to import/export views MB-8436. You can leave there your feedback and vote for it so it will be included in the next release.

In the meantime you can use Design Document REST API

Also there is a workaround blog

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top