all map function doc if doc Type chat_log emit null doc by_chatroom_da

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{
"all": {
"map": "function(doc) {if (doc.Type == 'chat_log') emit(null, doc);}"
},
"by_chatroom_date": {
"map": "function(doc) {if (doc.Type == 'chat_log') emit([doc.chatroom, doc.timestamp], doc);}"
},
"chatrooms": {
"map": "function(doc) {emit(doc.chatroom, null);}",
"reduce": "function(key, values) {return null;}"
},
"dates_for_chatroom": {
"map": "function(doc) {if (doc.Type == 'chat_log') {var tstamp = Date(doc.timestamp); emit([chatroom], tstamp.getFullYear()); emit([chatroom, tstamp.getFullYear()], tstamp.getMonth()); emit([chatroom, tstamp.getFullYear(), tstamp.getMonth()], tstamp.getDate());}}",
"reduce": "function(key, values) {result = [];for (var i=0; i<values.length; ++i) if (result.indexOf(values[i]) == -1) result.push(values[i]); return result;}"
}
}