You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Paul Oliver <pu...@gmail.com> on 2008/07/08 13:17:08 UTC
view question
Hi all,
I'm trying to get a simple view going. Can anybody tell me what I'm
doing wrong here? I'm using Apache CouchDB 0.8.0-incubating.
altais:~$ curl -H 'Content-Type:application/json' --data
'function(doc) { emit(null, doc); }'
http://localhost:5984/mydb/_temp_view
returns:
{"error":"EXIT","reason":"{function_clause,[{cjson,tokenize,\n
[\"function(doc) { emit(null, doc); }\",\n
{decoder,unicode,null,1,1,any}]},\n
{cjson,decode1,2},\n {cjson,json_decode,2},\n
{couch_httpd,handle_db_request,3},\n
{couch_httpd,handle_request,2},\n
{mochiweb_http,headers,4},\n {proc_lib,init_p,5}]}"}
Thanks in advance,
Paul.
Re: view question
Posted by Jan Lehnardt <ja...@apache.org>.
On Jul 8, 2008, at 13:17, Paul Oliver wrote:
> Hi all,
>
> I'm trying to get a simple view going. Can anybody tell me what I'm
> doing wrong here? I'm using Apache CouchDB 0.8.0-incubating.
>
> altais:~$ curl -H 'Content-Type:application/json' --data
> 'function(doc) { emit(null, doc); }'
> http://localhost:5984/mydb/_temp_view
>
> returns:
>
> {"error":"EXIT","reason":"{function_clause,[{cjson,tokenize,\n
> [\"function(doc) { emit(null, doc); }\",\n
> {decoder,unicode,null,1,1,any}]},\n
> {cjson,decode1,2},\n {cjson,json_decode,2},\n
> {couch_httpd,handle_db_request,3},\n
> {couch_httpd,handle_request,2},\n
> {mochiweb_http,headers,4},\n {proc_lib,init_p,5}]}"}
>
You now longer just send the map function code, you need
to send a proper JSON object see "Ad Hoc Views" at
http://wiki.apache.org/couchdb/HttpViewApi and "View Definition
Changes" at http://wiki.apache.org/couchdb/BreakingChanges
Cheers
Jan
--
Re: view question
Posted by James Aspinwall <ja...@gmail.com>.
Try replacing data:
--data '{"map" : "function(doc) { emit(null, doc); }"}'
On Jul 8, 2008, at 7:17 AM, Paul Oliver wrote:
> Hi all,
>
> I'm trying to get a simple view going. Can anybody tell me what I'm
> doing wrong here? I'm using Apache CouchDB 0.8.0-incubating.
>
> altais:~$ curl -H 'Content-Type:application/json' --data
> 'function(doc) { emit(null, doc); }'
> http://localhost:5984/mydb/_temp_view
>
> returns:
>
> {"error":"EXIT","reason":"{function_clause,[{cjson,tokenize,\n
> [\"function(doc) { emit(null, doc); }\",\n
> {decoder,unicode,null,1,1,any}]},\n
> {cjson,decode1,2},\n {cjson,json_decode,2},\n
> {couch_httpd,handle_db_request,3},\n
> {couch_httpd,handle_request,2},\n
> {mochiweb_http,headers,4},\n {proc_lib,init_p,5}]}"}
>
> Thanks in advance,
> Paul.