O'Reilly logo

CouchDB and PHP Web Development Beginner's Guide by Tim Juravich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — creating the reduce function in Futon

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:

What just happened?

We just used Futon to update our view to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required