couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Reed <joel.r...@visn.biz>
Subject Creating a permanent view
Date Wed, 20 Aug 2008 15:21:52 GMT
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

And get a lengthy error message:

{"error":"EXIT","reason":"{function_clause,\n    [{couch_httpd,handle_db_request,\n      
  
[{mochiweb_request,#Port<0.349>,'GET',\n              
\"\/cs-cache\/_view\/_design\/forms\/all\",\n              
{1,1},\n              {9,\n               {\"host\",\n                
{'Host',\"localhost:5984\"},\n                {\"accept\",\n                 
{'Accept',\n                     \"text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8\"},\n
 nil,\n                 {\"accept-language\",\n                  
{'Accept-Language',\"en-us,en;q=0.5\"},\n                  
{\"accept-encoding\",\n                   
{'Accept-Encoding',\"gzip,deflate\"},\n                   
{\"accept-charset\",\n                    
{'Accept-Charset',\"ISO-8859-1,utf-8;q=0.7,*;q=0.7\"},\n                    
nil,nil},\n                   nil},\n                  {\"connection\",\n                
  
{'Connection',\"keep-alive\"},\n                   nil,\n                   
{\"cookie\",\n                    {'Cookie',\n                       
 \"sessionId=cca8e4b9-0de4-4d71-9bf0-f4aeb382dde7\"},\n                    nil,nil}}}},\n
 {\"user-agent\",\n                 {'User-Agent',\n                     
\"Mozilla\/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko\/2008071816 
Ubuntu\/8.10 (intrepid) Firefox\/3.0.1\"},\n                
 {\"keep-alive\",{'Keep-Alive',\"300\"},nil,nil},\n                 nil}}}},\n          
'GET',\n          {\"cs-cache\",<0.230.0>,[\"_view\",\"_design\",\"forms\",\"all\"]}]},\n
    
{couch_httpd,handle_request,2},\n     {mochiweb_http,headers,4},\n     {proc_lib,init_p,5}]}"}

Can anyone point out my error? Most google examples I see are doing _temp_view stuff.

jr



Mime
View raw message