-
Book Overview & Buying
-
Table Of Contents
CouchDB and PHP Web Development Beginner's Guide
By :
Adding a reduce function to a view is surprisingly easy to do using Futon.
1. Open your browser and go to the verge database in Futon (http://localhost:5984/_utils/database.html?verge).
2. Click on the view drop-down box, and you'll see the application (the name of our design document). You can click on the view called posts_by_user.
3. Click on View Code, so that you can see the text areas for Map and Reduce.
4. Enter _count into the Reduce text area, and click on Save.
5. You can verify that your reduce function is working properly by clicking on the Reduce checkbox right below the Save button.
6. You should see a screenshot similar to the following:

We just used Futon to update our view to use a _count reduce function. We then tested the reduce function in the same view by clicking on the Reduce checkbox. You'll notice that our reduce function also returned a key/value pair with the key equal to the username and...
Change the font size
Change margin width
Change background colour