_design/measurements
This view is only used in the measurements
subsystem.
Both views find only measurement documents ("type" === "measurement"
).
measurements
Emits [measurement_name, Y, M, D, H, M, S]
as key and the log as value.
map
function(doc) {
if (!doc.type || !doc.timestamp) return;
if (doc.type !== "measurement") return;
var then = new Date(Date.parse(doc.timestamp));
var the_log = doc.log || "No log";
emit([doc.measurement_name || "Unknown",
then.getUTCFullYear(), then.getUTCMonth(),
then.getUTCDate(), then.getUTCHours(),
then.getUTCMinutes(), then.getUTCSeconds()], the_log.trim());
}
reduce
: _count
measurements_label
Emits [Y, M, D, H, M, S, measurement_namee]
as key and the log as value.
map
function(doc) {
if (!doc.type || !doc.timestamp) return;
if (doc.type !== "measurement") return;
var then = new Date(Date.parse(doc.timestamp));
var the_log = doc.log || "No log";
emit([then.getUTCFullYear(), then.getUTCMonth(),
then.getUTCDate(), then.getUTCHours(),
then.getUTCMinutes(), then.getUTCSeconds(),
doc.measurement_name || "Unknown"], the_log.trim());
}
reduce
: _count
This is only used on the measurement site in the calendar view.