couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sho Fukamachi <sho.fukama...@gmail.com>
Subject Re: Newbie: How to create a View
Date Sun, 20 Jul 2008 17:34:46 GMT
Avi,

as a fellow newbie embarked on a CouchDB crash course I hope I can help.

Can you access Futon, the couchdb web interface? If you can, create a  
database $MY_DB and switch to it.

Choose a namespace for your view ($VIEW) (ie just make something up!).  
Then create a new document in that database with the name "_design/ 
$VIEW".

Futon should now switch to your new document. Create a field in it  
called "views". Save.

Futon is a bit weird about how it presents text editors for fields, so  
first put "{}" into the views field and save. Then, double click it  
again and you should have a nice big text window.

Now copy this into the views field:

{
    "get_all": {
        "map": "function(doc) { emit(null, doc); }"
    }
}

And save.

Now hit your database at

http://localhost:5984/$MY_DB/_view/$VIEW/get_all

and you should see your view in action! Change/add more as you see fit.

Let me know how you go. I agree the docs could be a little easier to  
understand, maybe I will try to write up something "from zero"...

Sho



On 21/07/2008, at 2:44 AM, Avi Flax wrote:

> I must be missing something, but after scouring the website and  
> searching
> the list via markmail, I can't seem to find a straight-forward  
> explanation
> of how to create a View. Could someone please point me to one?
> Thanks,
> Avi
>
> -- 
> Avi Flax » Lead Technologist » Partner » Arc90 » http://arc90.com


Mime
View raw message