design/activities/activities-design.json
{"views":{"byPlanet":{"map":"function (doc) {\n emit(doc.createdOn, 1);\n }","reduce":"_count"},"byPlanetRecent":{"map":"function (doc) {\n var today = new Date(Date.now()).setHours(0, 0, 0, 0);\n var docDate = doc.loginTime || doc.time;\n // 86400000 milliseconds per day\n // 29 previous days plus current day = most recent 30 days\n if ((today - docDate) < (29 * 86400000)) {\n emit(doc.createdOn, 1);\n }\n }","reduce":"_count"},"grouped":{"map":"function (doc) {\n var time = doc.loginTime || doc.time;\n var date = new Date(time);\n if (typeof time === 'number') {\n emit({ createdOn: doc.createdOn, parentCode: doc.parentCode, month: date.getMonth(), year: date.getFullYear(), resourceId: doc.resourceId, title: doc.title, user: doc.user }, time);\n }\n }","reduce":"_stats"},"byUser":{"map":"function (doc) {\n var time = doc.loginTime || doc.time;\n if (typeof time === 'number') {\n emit({ createdOn: doc.createdOn, parentCode: doc.parentCode, user: doc.user }, time);\n }\n }","reduce":"_stats"}}}