Skip to content

Instantly share code, notes, and snippets.

@elsehow
Last active August 29, 2015 14:22
Show Gist options
  • Save elsehow/5d2a7e8c53042ba26058 to your computer and use it in GitHub Desktop.
Save elsehow/5d2a7e8c53042ba26058 to your computer and use it in GitHub Desktop.
Couch DB views or for indra
// here are a couple couchDB views I think might be handy
// use these as tempaltes for some views of your own
// if you're starting from a fresh couchDB, you'll have to add these views to a design document - consult couchDB reference for more info
// byCreatedAt
function(doc) {
var type, data, createdAt;
if (doc.type && doc.data && doc.createdAt) {
emit(doc.createdAt, doc);
}
}
// byType
function(doc) {
var type, data, createdAt;
if (doc.type && doc.data && doc.createdAt) {
emit(doc.type, doc);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment