_design/execute_commands
These views are used to track commands that are exported in the DB (available to be called). It also tracks commands which have arrived and have not yet completed.
export_commands
Commands which are available to be called in the database.
map
function(doc) {
if (!doc.type || doc.type != 'export_commands') return;
for (var k in doc.keys) {
emit(k, [doc.keys[k].Info, doc.uuid, doc.log_servers]);
}
}
reduce
: _count
incomplete_commands
Commands which have not yet been completed.
map
function(doc) {
if (!doc.type || doc.type != 'command') return;
if (doc.response) return;
emit([doc.execute, doc._id], 1);
}
reduce
: _sum
complete_commands
Commands which have been completed (have a response
field).
map
function(doc) {
if (!doc.type || doc.type != 'command') return;
if (!doc.response) return;
emit([doc.execute, doc._id], 1);
}
reduce
: _sum
export_commands
map
function(doc) {
if (!doc.type || doc.type != 'export_commands') return;
for (var k in doc.keys) {
emit(k, [doc.keys[k].Info, doc.uuid, doc.log_servers]);
}
}
reduce
: _count
(in)complete_commands
).