{
"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;}"
}
}