You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by St...@nextgen.net on 2010/05/28 02:14:32 UTC

ERROR when querying view in design document

Hi, I am very very new to couchDB and am currently following a tutorial on 
design documents in which I have completed the following steps using my 
ubuntu 9.04 terminal with couchDB 0.8.0 incubating:

1. Create a .json file with the following code:

{
  "_id" : "_design/example",
  "views" : {
    "foo" : {
      "map" : "function(doc){ emit(doc._id, doc._rev)}"
    }
  }
}

2. Use curl to PUT the file to CouchDB (creating a database also)
curl -X PUT http://127.0.0.1:5984/basic
curl -X PUT http://127.0.0.1:5984/basic/_design/example -d @mydesign.json

....this resulted in a success message:
{"ok":true,"id":"_design/example","rev":...

3. add some empty documents to the database that I can then query:
curl -X POST http://127.0.0.1:5984/basic -d '{}'

4. Now query the view*:
curl http://127.0.0.1:5984/basic/_design/example/_view/foo

*it is this that gives me the following error:
{"error":"EXIT","reason":"{function_clause,\n 
[{couch_httpd,handle_db_request,\n 
[{mochiweb_request,#Port<0.2949>,'GET',\n 
\"\/basic\/_design\/example\/_view\/foo\",\n              {1,1},\n  {3,\n  
            {\"user-agent\",\n                {'User-Agent',\n  
\"curl\/7.18.2 (i486-pc-linux-gnu) libcurl\/7.18.2 OpenSSL\/0.9.8g 
zlib\/1.2.3.3 libidn\/1.10\"},\n                {\"host\",\n  
{'Host',\"127.0.0.1:5984\"},\n {\"accept\",{'Accept',\"*\/*\"},nil,nil},\n 
                nil},\n                nil}}},\n          'GET',\n  
{\"basic\",<0.6827.0>,[\"_design\",\"example\",\"_view\",\"foo\"]}]},\n  
{couch_httpd,handle_request,2},\n     {mochiweb_http,headers,4},\n 
{proc_lib,init_p_do_apply

...Any idea why??? I need to get this working ASAP because my boss is 
getting angry!

Steve

Re: ERROR when querying view in design document

Posted by St...@nextgen.net.
From:
Randall Leeds <ra...@gmail.com>
To:
user@couchdb.apache.org
Date:
28/05/2010 10:25 AM
Subject:
Re: ERROR when querying view in design document


yes, this has solved the problem and a lot of frustration! thank you very 
much

And Chris beat me to it.

On Thu, May 27, 2010 at 17:23, J Chris Anderson <jc...@gmail.com> wrote:
>
> On May 27, 2010, at 5:20 PM, Steven.Prentice@nextgen.net wrote:
>
>>> 4. Now query the view*:
>>> curl http://127.0.0.1:5984/basic/_design/example/_view/foo
>
> For 0.8.x you need to query the old URL. (We updated the API in 0.9)
>
>> curl http://127.0.0.1:5984/basic/_view/example/foo
>
> Chris



Re: ERROR when querying view in design document

Posted by Randall Leeds <ra...@gmail.com>.
And Chris beat me to it.

On Thu, May 27, 2010 at 17:23, J Chris Anderson <jc...@gmail.com> wrote:
>
> On May 27, 2010, at 5:20 PM, Steven.Prentice@nextgen.net wrote:
>
>>> 4. Now query the view*:
>>> curl http://127.0.0.1:5984/basic/_design/example/_view/foo
>
> For 0.8.x you need to query the old URL. (We updated the API in 0.9)
>
>> curl http://127.0.0.1:5984/basic/_view/example/foo
>
> Chris

Re: ERROR when querying view in design document

Posted by J Chris Anderson <jc...@gmail.com>.
On May 27, 2010, at 5:20 PM, Steven.Prentice@nextgen.net wrote:

>> 4. Now query the view*:
>> curl http://127.0.0.1:5984/basic/_design/example/_view/foo

For 0.8.x you need to query the old URL. (We updated the API in 0.9)

> curl http://127.0.0.1:5984/basic/_view/example/foo

Chris

Re: ERROR when querying view in design document

Posted by Randall Leeds <ra...@gmail.com>.
In this case your problem is that the paths for view names changed
between 0.8 and 0.9.

You want http://127.0.0.1:5984/basic/_view/example/foo

See http://wiki.apache.org/couchdb/Breaking_changes

Upgrading (if at all possible) would be a great idea. Documentation
you find will be more accurate and you'll get lots of new
functionality and improvements.

On Thu, May 27, 2010 at 17:20,  <St...@nextgen.net> wrote:
> Well, at the moment I am working on a remote server which just happens to
> have that version on it, I am currently unsure as to weather or not I have
> permission to upgrade it (as I am at work). basically when I log in from
> my windows desktop using NX Client I am presented with an ubuntu system
> with all my *required* software already on there
>
> Steve
>
>
>
> From:
> Randall Leeds <ra...@gmail.com>
> To:
> user@couchdb.apache.org
> Date:
> 28/05/2010 10:16 AM
> Subject:
> Re: ERROR when querying view in design document
>
>
>
> I'm not sure what your error is, but before I look at is there a
> reason you're using 0.8.0-incubating? That release is a couple years
> old. The newest is 0.11.0.
>
> http://couchdb.apache.org/downloads.html
>
> -Randall
>
> On Thu, May 27, 2010 at 17:14,  <St...@nextgen.net> wrote:
>> Hi, I am very very new to couchDB and am currently following a tutorial
> on
>> design documents in which I have completed the following steps using my
>> ubuntu 9.04 terminal with couchDB 0.8.0 incubating:
>>
>> 1. Create a .json file with the following code:
>>
>> {
>>  "_id" : "_design/example",
>>  "views" : {
>>    "foo" : {
>>      "map" : "function(doc){ emit(doc._id, doc._rev)}"
>>    }
>>  }
>> }
>>
>> 2. Use curl to PUT the file to CouchDB (creating a database also)
>> curl -X PUT http://127.0.0.1:5984/basic
>> curl -X PUT http://127.0.0.1:5984/basic/_design/example -d
> @mydesign.json
>>
>> ....this resulted in a success message:
>> {"ok":true,"id":"_design/example","rev":...
>>
>> 3. add some empty documents to the database that I can then query:
>> curl -X POST http://127.0.0.1:5984/basic -d '{}'
>>
>> 4. Now query the view*:
>> curl http://127.0.0.1:5984/basic/_design/example/_view/foo
>>
>> *it is this that gives me the following error:
>> {"error":"EXIT","reason":"{function_clause,\n
>> [{couch_httpd,handle_db_request,\n
>> [{mochiweb_request,#Port<0.2949>,'GET',\n
>> \"\/basic\/_design\/example\/_view\/foo\",\n              {1,1},\n
>  {3,\n
>>            {\"user-agent\",\n                {'User-Agent',\n
>> \"curl\/7.18.2 (i486-pc-linux-gnu) libcurl\/7.18.2 OpenSSL\/0.9.8g
>> zlib\/1.2.3.3 libidn\/1.10\"},\n                {\"host\",\n
>> {'Host',\"127.0.0.1:5984\"},\n
> {\"accept\",{'Accept',\"*\/*\"},nil,nil},\n
>>                nil},\n                nil}}},\n          'GET',\n
>> {\"basic\",<0.6827.0>,[\"_design\",\"example\",\"_view\",\"foo\"]}]},\n
>> {couch_httpd,handle_request,2},\n     {mochiweb_http,headers,4},\n
>> {proc_lib,init_p_do_apply
>>
>> ...Any idea why??? I need to get this working ASAP because my boss is
>> getting angry!
>>
>> Steve
>
>
>

Re: ERROR when querying view in design document

Posted by St...@nextgen.net.
Well, at the moment I am working on a remote server which just happens to 
have that version on it, I am currently unsure as to weather or not I have 
permission to upgrade it (as I am at work). basically when I log in from 
my windows desktop using NX Client I am presented with an ubuntu system 
with all my *required* software already on there 

Steve



From:
Randall Leeds <ra...@gmail.com>
To:
user@couchdb.apache.org
Date:
28/05/2010 10:16 AM
Subject:
Re: ERROR when querying view in design document



I'm not sure what your error is, but before I look at is there a
reason you're using 0.8.0-incubating? That release is a couple years
old. The newest is 0.11.0.

http://couchdb.apache.org/downloads.html

-Randall

On Thu, May 27, 2010 at 17:14,  <St...@nextgen.net> wrote:
> Hi, I am very very new to couchDB and am currently following a tutorial 
on
> design documents in which I have completed the following steps using my
> ubuntu 9.04 terminal with couchDB 0.8.0 incubating:
>
> 1. Create a .json file with the following code:
>
> {
>  "_id" : "_design/example",
>  "views" : {
>    "foo" : {
>      "map" : "function(doc){ emit(doc._id, doc._rev)}"
>    }
>  }
> }
>
> 2. Use curl to PUT the file to CouchDB (creating a database also)
> curl -X PUT http://127.0.0.1:5984/basic
> curl -X PUT http://127.0.0.1:5984/basic/_design/example -d 
@mydesign.json
>
> ....this resulted in a success message:
> {"ok":true,"id":"_design/example","rev":...
>
> 3. add some empty documents to the database that I can then query:
> curl -X POST http://127.0.0.1:5984/basic -d '{}'
>
> 4. Now query the view*:
> curl http://127.0.0.1:5984/basic/_design/example/_view/foo
>
> *it is this that gives me the following error:
> {"error":"EXIT","reason":"{function_clause,\n
> [{couch_httpd,handle_db_request,\n
> [{mochiweb_request,#Port<0.2949>,'GET',\n
> \"\/basic\/_design\/example\/_view\/foo\",\n              {1,1},\n 
 {3,\n
>            {\"user-agent\",\n                {'User-Agent',\n
> \"curl\/7.18.2 (i486-pc-linux-gnu) libcurl\/7.18.2 OpenSSL\/0.9.8g
> zlib\/1.2.3.3 libidn\/1.10\"},\n                {\"host\",\n
> {'Host',\"127.0.0.1:5984\"},\n 
{\"accept\",{'Accept',\"*\/*\"},nil,nil},\n
>                nil},\n                nil}}},\n          'GET',\n
> {\"basic\",<0.6827.0>,[\"_design\",\"example\",\"_view\",\"foo\"]}]},\n
> {couch_httpd,handle_request,2},\n     {mochiweb_http,headers,4},\n
> {proc_lib,init_p_do_apply
>
> ...Any idea why??? I need to get this working ASAP because my boss is
> getting angry!
>
> Steve



Re: ERROR when querying view in design document

Posted by Randall Leeds <ra...@gmail.com>.
I'm not sure what your error is, but before I look at is there a
reason you're using 0.8.0-incubating? That release is a couple years
old. The newest is 0.11.0.

http://couchdb.apache.org/downloads.html

-Randall

On Thu, May 27, 2010 at 17:14,  <St...@nextgen.net> wrote:
> Hi, I am very very new to couchDB and am currently following a tutorial on
> design documents in which I have completed the following steps using my
> ubuntu 9.04 terminal with couchDB 0.8.0 incubating:
>
> 1. Create a .json file with the following code:
>
> {
>  "_id" : "_design/example",
>  "views" : {
>    "foo" : {
>      "map" : "function(doc){ emit(doc._id, doc._rev)}"
>    }
>  }
> }
>
> 2. Use curl to PUT the file to CouchDB (creating a database also)
> curl -X PUT http://127.0.0.1:5984/basic
> curl -X PUT http://127.0.0.1:5984/basic/_design/example -d @mydesign.json
>
> ....this resulted in a success message:
> {"ok":true,"id":"_design/example","rev":...
>
> 3. add some empty documents to the database that I can then query:
> curl -X POST http://127.0.0.1:5984/basic -d '{}'
>
> 4. Now query the view*:
> curl http://127.0.0.1:5984/basic/_design/example/_view/foo
>
> *it is this that gives me the following error:
> {"error":"EXIT","reason":"{function_clause,\n
> [{couch_httpd,handle_db_request,\n
> [{mochiweb_request,#Port<0.2949>,'GET',\n
> \"\/basic\/_design\/example\/_view\/foo\",\n              {1,1},\n  {3,\n
>            {\"user-agent\",\n                {'User-Agent',\n
> \"curl\/7.18.2 (i486-pc-linux-gnu) libcurl\/7.18.2 OpenSSL\/0.9.8g
> zlib\/1.2.3.3 libidn\/1.10\"},\n                {\"host\",\n
> {'Host',\"127.0.0.1:5984\"},\n {\"accept\",{'Accept',\"*\/*\"},nil,nil},\n
>                nil},\n                nil}}},\n          'GET',\n
> {\"basic\",<0.6827.0>,[\"_design\",\"example\",\"_view\",\"foo\"]}]},\n
> {couch_httpd,handle_request,2},\n     {mochiweb_http,headers,4},\n
> {proc_lib,init_p_do_apply
>
> ...Any idea why??? I need to get this working ASAP because my boss is
> getting angry!
>
> Steve