export all
[disclosr.git] / admin / refreshDesignDoc.php
blob:a/admin/refreshDesignDoc.php -> blob:b/admin/refreshDesignDoc.php
--- a/admin/refreshDesignDoc.php
+++ b/admin/refreshDesignDoc.php
@@ -13,7 +13,16 @@
 $obj->views->byDateMonthYear->reduce = "_count";
 $obj->views->byAgencyID->map = "function(doc) {   emit(doc.agencyID, doc); };";
 $obj->views->byAgencyID->reduce = "_count";
+$obj->views->fieldNames->map = '
+function(doc) {
+for(var propName in doc) {
+     	emit(propName, doc._id);
+	}
 
+}';
+$obj->views->fieldNames->reduce = 'function (key, values, rereduce) {
+    return values.length;
+}';
 // allow safe updates (even if slightly slower due to extra: rev-detection check).
 $foidb->save($obj, true);