incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: New to couchdb, question about dynamic view?
Date Wed, 15 Apr 2009 17:24:24 GMT
Jason,

You'll want something like:

{
    "_id": "_design/foo",
    "views": {
        "bar": "function(doc) {if(doc.attribute) emit(doc.attribute, null);}"
    }
}

After saving that you can use a URL like:

http://127.0.0.1:5984/db_name/_design/foo/_view/bar?key=user_input

And you'll get the list of docs that have that attribute.

HTH,
Paul Davis

On Wed, Apr 15, 2009 at 1:15 PM, Jason Tahaney
<jtahaney@offhourstech.com> wrote:
> Hello,
>
> Very new to couchdb.  Can someone please tell me how I would represent a
> search for an attribute value (say from user input) in a design view?  Are
> design views static (everything I read points to yes)?  I'm probably trying
> to use the wrong feature.  Just looking for a way to say search where
> attribute=value and value comes from user input.
>
> Thanks,
>
> Jason
>

Mime
View raw message