-
Notifications
You must be signed in to change notification settings - Fork 2
/
views.json
16 lines (16 loc) · 853 Bytes
/
views.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"_id": "_design/tags",
"views": {
"all": {
"map": "function(doc) { if (doc.tags != null){ for(var i=0; i < doc.tags.length; i++)
{ emit(doc.tags[i], null); }}}"
},
"count": {
"map": "function(doc) { if (doc.tags != null){ for(var i=0; i < doc.tags.length; i++)
{ emit(doc.tags[i], 1);}}}",
"reduce": "function(keys, values, rereduce){ var sum = 0; for (var val in values){ sum += values[val]; } return sum;}"
},
"group" : {
"map": "function(doc) { if (doc.tags != null){ for(var i=0; i < doc.tags.length; i++)
{ for(var j=0; j < doc.tags.length; j++)
{ if (doc.tags[i] != doc.tags[j]) { emit([doc.tags[i], doc.tags[j]], 1);}}}}}",
"reduce": "function(keys, values, rereduce){ var sum = 0; for (var val in values){ sum += values[val]; } return sum;}"
}
}
}