couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Clark <>
Subject Re: Subselect Possible?
Date Tue, 28 Sep 2010 17:03:07 GMT
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 ( < 0) {

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.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message