incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Weber <scotty2...@sbcglobal.net>
Subject SERVER ERROR on a filter.
Date Tue, 04 Feb 2014 01:05:13 GMT
I am now working with filters.  I have created a small handful of docs.  Each one consists
of an array of fields.  A sample of one is below:

{  "_id": "101", "_rev": "1-b3303229104420834b1cf8fd22a75676", "name": "101", "flds": [ "10",
"11", "aa", "bb" ] }

And here is the filter function I am using (in a design called "lookup"):
"filters": { "getdoc": "function(doc, req) { 
log(doc.flds[1]); 
return true;}" }

I get the correct response for the URL: http://localhost:5984/db/_changes?filter=/lookup/getdoc,
with a code of 200.
And the function *does* log "doc.flds[1]" as expected.

Then the log shows a server error 500, reporting that "doc.flds" in undefined.  All occurring
within one HTTP request.

The full log of the error is below (complete with line wrapping).  Is something broken?  Or
am I doing something incorrect?

Thanks for any advice.

-Scott

[info] [<0.2067.0>] 127.0.0.1 - - GET /db/_changes?filter=/lookup/getdoc 200
[info] [<0.200.0>] OS Process #Port<0.5107> Log :: 11
[info] [<0.200.0>] OS Process #Port<0.5107> Log :: 12
[info] [<0.200.0>] OS Process #Port<0.5107> Log :: 13
[info] [<0.200.0>] OS Process #Port<0.5107> Log :: 14
[info] [<0.200.0>] OS Process #Port<0.5107> Log :: 15
[info] [<0.200.0>] OS Process #Port<0.5107> Log :: 16
[info] [<0.200.0>] OS Process #Port<0.5107> Log :: 17
[error] [<0.2067.0>] OS Process Error <0.200.0> :: {<<"TypeError">>,
{[{<<"message">>,
<<"doc.flds is undefined">>},
{<<"fileName">>,
<<"filters.getdoc">>},
{<<"lineNumber">>,1},
{<<"stack">>,
<<"([object Object],[object Object])@filters.getdoc:1\n(function (doc, req) {log(doc.flds[1]);return
true;},[object Object],[object Array])@../share/couchdb/server/main.js:510\n(\"_design/lookup\",[object
Array],[object Array])@../share/couchdb/server/main.js:1517\n()@../share/couchdb/server/main.js:1562\n@../share/couchdb/server/main.js:1573\n">>}]}}
[info] [<0.2067.0>] 127.0.0.1 - - GET /db/_changes?filter=/lookup/getdoc 500
[error] [<0.2067.0>] httpd 500 error response:
{"error":"TypeError","reason":"{[{<<\"message\">>,<<\"doc.flds is undefined\">>},\n
 {<<\"fileName\">>,<<\"filters.getdoc\">>},\n  {<<\"lineNumber\">>,1},\n
 {<<\"stack\">>,\n   <<\"([object Object],[object Object])@filters.getdoc:1\\n(function
(doc, req) {log(doc.flds[1]);return true;},[object Object],[object Array])@../share/couchdb/server/main.js:510\\n(\\\"_design/lookup\\\",[object
Array],[object Array])@../share/couchdb/server/main.js:1517\\n()@../share/couchdb/server/main.js:1562\\n@../share/couchdb/server/main.js:1573\\n\">>}]}"}
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message