2013-05-20 17:46:49 -04:00
{
"_id" : "_design/posts" ,
"language" : "javascript" ,
"views" : {
"listTags" : {
"map" : "function(doc) {\n if (doc.type === \"post\") {\n for (var i in doc.tags) {\n emit(doc.tags[i], null);\n }\n }\n}" ,
"reduce" : "function(keys, values) {\n return null;\n}"
} ,
"listPosts" : {
"map" : "function(doc) {\n if (doc.type === \"post\") {\n emit([doc.created_at, doc.slug], doc)\n }\n}"
} ,
"listPostsBySlug" : {
"map" : "function(doc) {\n if (doc.type === \"post\") {\n var date = new Date(doc.created_at)\n var dateStr = date.getFullYear() + \"-\" + (date.getMonth() + 1) + \"-\" + date.getDate()\n emit([dateStr, doc.slug], doc)\n }\n}"
} ,
"listPublishedPosts" : {
"map" : "function(doc) {\n if (doc.type === \"post\" && doc.published === true) {\n emit([doc.created_at, doc.slug], doc)\n }\n}"
} ,
"countPublishedPosts" : {
"map" : "function(doc) {\n if (doc.type === \"post\" && doc.published === true) {\n emit(\"published post\", 1)\n }\n}" ,
"reduce" : "function(keys, values) {\n return sum(values);\n}"
} ,
"countPosts" : {
"map" : "function(doc) {\n if (doc.type === \"post\") {\n emit(\"any post\", 1)\n }\n}" ,
"reduce" : "function(keys, values) {\n return sum(values);\n}"
2013-05-26 16:57:58 -04:00
} ,
"listPostsByTag" : {
"map" : "function(doc) {\n if (doc.type === \"post\") {\n for (var i = 0; i < doc.tags.length; ++i) {\n var post = {created_at: doc.created_at,\n slug: doc.slug,\n title: doc.title};\n emit(doc.tags[i], post)\n }\n }\n}"
} ,
"listPublishedPostsByTag" : {
"map" : "function(doc) {\n if (doc.type === \"post\" && doc.published === true) {\n for (var i = 0; i < doc.tags.length; ++i) {\n var post = {created_at: doc.created_at,\n slug: doc.slug,\n title: doc.title};\n emit(doc.tags[i], post)\n }\n }\n}"
2013-05-26 17:54:06 -04:00
} ,
"listPublishedPostsArchive" : {
"map" : "function(doc) {\n if (doc.type === \"post\" && doc.published === true) {\n var date = new Date(doc.created_at)\n var monthYearStr = (date.getMonth() + 1) + \"-\" + date.getFullYear();\n var post = {mmyyyy: monthYearStr,\n created_at: doc.created_at,\n slug: doc.slug,\n title: doc.title};\n emit(doc.created_at, post)\n }\n}"
} ,
"listPostsArchive" : {
"map" : "function(doc) {\n if (doc.type === \"post\") {\n var date = new Date(doc.created_at)\n var monthYearStr = (date.getMonth() + 1) + \"-\" + date.getFullYear();\n var post = {mmyyyy: monthYearStr,\n created_at: doc.created_at,\n slug: doc.slug,\n title: doc.title};\n emit(doc.created_at, post)\n }\n}"
2013-05-20 17:46:49 -04:00
}
}
}