Skip to content

Instantly share code, notes, and snippets.

@notch8-old
Created October 23, 2008 01:47
Show Gist options
  • Select an option

  • Save notch8-old/18894 to your computer and use it in GitHub Desktop.

Select an option

Save notch8-old/18894 to your computer and use it in GitHub Desktop.
function depth_first_categories(category){
category.categories.forEach(function(category){
emit(category.name, category);
depth_first_categories(category);
}
}
function(doc) {
if (doc['couchrest-type'] == 'CategoryList' && doc.categories) {
doc.categories.forEach(function(category){
depth_first_categories(category);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment