Well it turns out I have to loop over my query rows and write each chunk piece by piece. I don't know if there is any better way to do this:
var data = {posts:
function(chunk, context, bodies) {
return chunk.map(function(chunk) {
client.query("select * from blogposts", function (err, resultPosts) {
if (err) throw err;
for (index=0; index<resultPosts.rows.length; index++) {
chunk.render(bodies.block, context.push(resultPosts.rows[index]));
};
return chunk.end();
});
});
}
}