Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage CouchDB code out of it?

I am new to CouchDB way of making things. So, I have a lot of questions about it, but let's focus in one of them.

CouchDB has this concept of javascript code (validation + map-reduce + show + ?) being written in the design documents. This is part of the database, like stored procedures or triggers are for more tradittional databases.

Is there anybody maintaining this code inside a project so that we can actually test this code like any other javascript code (through jspec for instance, mocking the dependencies), version in the same repository we version the rest of our code, probably in a separate folder.. is it possible and used? Or isn't it good for some reason I should know?

What I would like to have is some way to do a single rake task and my couchdb design documents get synced with the project, something like that might be useful.

In the case of ruby, it would be helpful also to make some dynamic magic happen (e.g. default views and validations, new views through the use of named scopes).

like image 292
Victor Rodrigues Avatar asked Jan 26 '10 00:01

Victor Rodrigues


People also ask

How do I get data from CouchDB?

Using HTTP request headers, you can communicate with CouchDB. Through these requests we can retrieve data from the database, store data in to the database in the form of documents, and we can view as well as format the documents stored in a database.

What is the maximum number of views a document can have in CouchDB?

The default value for many OSes is 1024 or 4096. On a system with many databases or many views, CouchDB can very rapidly hit this limit.


1 Answers

Check out CouchApp: http://github.com/couchapp/couchapp

It's a set of python scripts that take a structured filesystem of js files (amongst others) and converts it into a well-formed Design Doc.

(Pardon me if I misunderstood your question)

like image 159
Dominic Barnes Avatar answered Oct 03 '22 00:10

Dominic Barnes