changeset 212:1262b1168f1f

calculate the number of unread entries while performing map/reduce
author dirk
date Sat, 18 Aug 2012 04:44:51 +0200
parents c694bfb732bc
children 524cbf9e413c
files backend/couchdb/CouchApp/feedworm/views/feeds_with_unread_entries/map.js backend/couchdb/CouchApp/feedworm/views/feeds_with_unread_entries/reduce.js
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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);
     }
 }
--- 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);
 }