incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Prentice <steven.prentice...@gmail.com>
Subject using req.query to filter a list function in couchDB 0.10.0
Date Sun, 18 Jul 2010 23:12:02 GMT
Hi,
I am trying to use a list function to filter the results of a view in my
database. I have developed the following code, but keep getting a reference
error when making a request:

Request = curl -X GET
'..../_design/dates/_list/param/audit_resource_subresource_with_criteria?as="TestUser"'

(param is the name of my list function)

the function looks like this...what I am trying to do is allow someone to
enter the name of the user to filter the view for just rows where the
accessingsystem field = what is entered:

function(head, req)
{
    var accessingsystem = req.query['as'];
    var row;
    while(row = getRow())
    {
        if (as && row.value[1] != as)
        {
            continue;
        }
        send(row.value);
    }
}

the error i get is {"code":500,"error":"render_error","reason":"function
raised error: ReferenceError: as is not defined"}

any help = much appreciated!
Steve

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message