Answer the question
In order to leave comments, you need to log in
How to add the result of another query to the result of one query?
exports.all = function(cb) {
db.get().collection('tasks').find({"parent_id": null}).sort({order: 1}).toArray(function(err, docs) {
docs.forEach( function (x) {
x.sub = db.get().collection('tasks').find({"parent_id": x._id.toString()}).sort({order: 1}).toArray();
});
cb(err, docs);
});
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question