Skip to content

Instantly share code, notes, and snippets.

@chebyte
Created July 22, 2011 01:07
Show Gist options
  • Save chebyte/1098625 to your computer and use it in GitHub Desktop.
Save chebyte/1098625 to your computer and use it in GitHub Desktop.
many views in one design document on couchdb
{
"_id": "_design/articles",
"language": "javascript",
"views": {
"all": {
"map": "function(doc) { if(doc.type == 'article') { emit(null, doc); } }"
},
"by_author_id": {
"map": "function(doc) { if(doc.type == 'article') { emit([doc.author_id], doc); } }"
},
"by_status": {
"map": "function(doc) { if(doc.type == 'article') { emit([doc.status], doc); } }"
},
"titles": {
"map": "function(doc) { if(doc.type == 'article') { emit(null, { 'id': doc._id, 'title': doc.title }); } }"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment