MyCollection.afterRemote('csv', function(ctx, next) {
// FIXME: use a proper CSV formatter that can escape string values containing "," characters
var csv = ctx.result.rows.map(function(r) {
return r.join(',');
}).join('\n');
ctx.res.header('Content-Type', 'text/csv');
ctx.res.send(csv);
// next() must not be called!
});