I'm using Flask and CouchDB. I've mapped a file document to a file object.
class File(Document):
name = TextField()
conten = TextField()
In my Flask Blueprint I want to return all files. How do I do that. I know that I've to write a view like:
function(doc) {
if(doc.type == 'file') {
emit(doc_id, doc)
}
}
But where do I've to put this piece of code? In my File
object? Do I've to add this view definition to the CouchDBManager
? Or should I use the query function?