couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <jch...@grabb.it>
Subject Re: Creating a permanent view
Date Wed, 20 Aug 2008 23:48:47 GMT
Joel,

For simple editing tasks like this, I tend to use the Futon web interface:

http://localhost:5984/_utils/

I'm guessing you've already been using it, but it doesn't hurt to put
it in the thread here.

On Wed, Aug 20, 2008 at 11:23 AM, Joel Reed <joel.reed@visn.biz> wrote:
> Joel Reed wrote:
>>
>> I've been poking around on the wiki site and googling for answers, but
>> can't quite come up with the right syntax yet to create a permanent view and
>> then GET the results.
>>
>> I have a "test.view" file that looks like this:
>>
>> {
>>  "_id":"_design/forms",
>>  "_rev":"12345",
>>  "views":
>>  {
>>   "all": {
>>     "map": "function(doc) { emit(doc.Patient, doc); }"
>>      }
>>  }
>> }
>>
>> Then I say:
>>
>> curl -v -H 'Content-Type: application/json;'
>> "http://localhost:5984/cs-cache/" --data-binary @/home/jreed/test.view
>>
>> They I try to fire up:
>> http://localhost:5984/cs-cache/_view/_design/forms/all
>
> Ok, I figured out what I was doing wrong. The correct steps appear to be:
>
> 1) Create a test.view file WITHOUT a "_rev" entry that looks like this:
>
> {
>  "_id":"_design/forms",
>  "views":
>  {
>   "all": {
>     "map": "function(doc) { log(doc); emit(doc.Patient, doc); }"
>   }
>  }
> }
>
> 2) Submit to couchdb with curl like this:
>
> curl -v -X PUT -H 'Content-Type: application/json'
> http://localhost:5984/cs-cache/_design/forms -T /home/jreed/test.view
>
> 3) test the view using a URL like this:
>
> http://localhost:5984/cs-cache/_view/forms/all
>
> Thanks Jan for helping me on the last step. I'm very new to couchdb, thus my
> confusion.
>
> jr
>



-- 
Chris Anderson
http://jchris.mfdz.com

Mime
View raw message