I am trying to write Erlang list functions in CouchDB, however, I am not familiar with the data types returned, and how to manipulate them accordingly. I would like some one to show me how to translate the simple Javascript List function below into an Erlang list function. That would be a good point for me to start.
function(head, req) {
var row,resp={},data=[];
if(head){
resp["total_rows"] = head.total_rows;
}
while(row = getRow()) {
data.push(row);
}
resp.rows = data;
return JSON.stringify(resp);
}
Thanks, in advance.
Have you looked at the couchdb Test Suite. You'll find the erlang views at utils/script/test/erlang_views.js
The code in the test suite often helps me when I'm stuck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With