聚合函数和多个填充如何一起离开? 此代码返回“ TypeError:Installation.populate(...)。exec不是函数”
tableA.aggregate(
[
{
$lookup: {
from: "tableB",
localField: "_id",
foreignField: "_id",
as: "TableB"
}
},
{
$unwind: { path: "$TableB"}
},
{
$match: {"TableB.Email" : "orixaf@gmail.com"}
}
]
,function (err, results) {
tableA.populate(results,'Parent','Company').exec(function(err, results) {
tableA.count(filter).exec(function(err, count) {
res.send({ success: true, results: results, total: count });
});
});
});