# HG changeset patch # User dirk # Date 1345257891 -7200 # Node ID 1262b1168f1f856110336878ffa88d98ea418e5f # Parent c694bfb732bc55758643ba89cd5eb651c27f5bac calculate the number of unread entries while performing map/reduce diff -r c694bfb732bc -r 1262b1168f1f backend/couchdb/CouchApp/feedworm/views/feeds_with_unread_entries/map.js --- a/backend/couchdb/CouchApp/feedworm/views/feeds_with_unread_entries/map.js Wed Jul 25 01:49:28 2012 +0200 +++ b/backend/couchdb/CouchApp/feedworm/views/feeds_with_unread_entries/map.js Sat Aug 18 04:44:51 2012 +0200 @@ -2,6 +2,6 @@ { if (doc.doctype == "feedEntry" && !doc.read) { - emit(doc.feed, null); + emit(doc.feed, 1); } } diff -r c694bfb732bc -r 1262b1168f1f backend/couchdb/CouchApp/feedworm/views/feeds_with_unread_entries/reduce.js --- a/backend/couchdb/CouchApp/feedworm/views/feeds_with_unread_entries/reduce.js Wed Jul 25 01:49:28 2012 +0200 +++ b/backend/couchdb/CouchApp/feedworm/views/feeds_with_unread_entries/reduce.js Sat Aug 18 04:44:51 2012 +0200 @@ -1,4 +1,4 @@ function(keys, values, rereduce) { - return true; + return sum(values); }