I have a set of nested queries with express/mongoose, pretty much like so:
app.get(..., function(...) {
Schema1.query(..., function(..., res1) {
for ( var key in res1 ) {
Schema2.query(..., function(..., res2) {
data[key].appendedAttribute = res2.somedata;
});
}
res.render(..., data);
});
});
Which doesnt work, that is, appendedAttribute is never appended to the dataset. What am I doing wrong?