I believe that you should be able to get something like this from the
following map function (pardon the pseudocode; I don't know your data id's)
function(doc) {
if (doc.work < 0) {
emit(doc._id,[doc.work,0]);
emit(doc.parent._id,[doc.work,1]);
}
}
where doc.parent._id is whatever the ID of the parent is. Now querying with
startkey= a_given_id and endkey=a_given_id gives you the node with
a_given_id if it has zero work and any of its zero-work children. This can
be extended pretty straightforwardly to descendents of arbitrary depth. You
can then use a reduce (or better a list if nodes with <0 work are not
sparse) which looks at the second element of the value to chop this down to
just the boolean.